Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / JavaBeans / November 2003

Tip: Looking for answers? Try searching our database.

Entity Beans Reference Question

Thread view: 
Haider Kazmi - 28 Oct 2003 21:33 GMT
Hi Guys, I havn't done all that much of EJB. I had a basic question. If I am
referencing one Entity bean from another, how does this get handled. Is the
container smart enough to know that it doesn't need to passivate the entire
referenced bean and only stores some kind of a reference from one bean to
another.

Lets say I have a entity bean called "Fruit"

From another entity bean, say "Farm" I  set this via a method
Farm.setFruit(Fruit apple);

within Farm I have Fruit as a instance variable, something like

public Fruint fruit=null;

public void setFruit(Fruit f) {
   this.fruit = f;
}

How will this apple be handled when I set it to this beans Fruit ??

Is this dependent on the container, How will say Weblogic handle as compared
to JBoss ???

Heeeeeeeelp

Thanks

cheers
Haider
Johann Burkard - 29 Oct 2003 19:26 GMT
> Hi Guys, I havn't done all that much of EJB. I had a basic question. If I am
> referencing one Entity bean from another, how does this get handled. Is the
[quoted text clipped - 14 lines]
>     this.fruit = f;
> }

I assume you are using CMP (Container Managed Persistence), right? With
CMP, there's no need to have instance variables for CMR (Container
Managed Relationships) fields. Instead, you'd use abstract getters and
setters and the local interface.

public interface FarmLocal extends EJBLocalObject {
 public void setFruit(FruitLocal f);
 public FruitLocal getFruit();
}

public class FarmEJB implements EntityBean {
 public abstract void setFruit(FruitLocal f);
 public abstract FruitLocal getFruit();
}

Johann
Signature

`/()|_| (/-\|\| |-|/-\\/3 |\/|`/ |3/-\|\||)\/\/||)7|-| ||°|-| `/()|_|
/-\5|< |\||(3|_`/

Marcus Beyer - 05 Nov 2003 13:23 GMT
> Hi Guys, I havn't done all that much of EJB. I had a basic question. If I am
> referencing one Entity bean from another, how does this get handled. Is the
> container smart enough to know that it doesn't need to passivate the entire
> referenced bean and only stores some kind of a reference from one bean to
> another.

"In JBoss, EJBs thus are a robust data cache for the web layers. A
typical web application will use servlet/JSP and your favorite portal
application to access the EJBs. Since EJBs carry their own optimized
caches, we would think that we can work at in-memory speed throughout
our stack. Unfortunately, by specification, the EJBs are remote and
require the usage of the pass by copy semantic. Serialization is back in
full force even as the web layer communicates directly with the EJB
container (Tomcat in JBoss is optimized in that way). The specification
deals with this in a very “spec heavy” way that requires you to use
local interfaces to achieve a very simple result. This is a clear case
of the spec gone wild, looping onto its own logic and patching
spec-created problems by adding yet another intrusive layer of
complexity in the application design. Local interfaces are a
“spec patch” not a first class citizen. In JBoss, we optimize away this
RPC layer, transparently and automatically to the EJB programmer."

from: http://www.jboss.org/modules/html/blue.pdf

Don't know how this is handled by other products ...

Marcus
Marcus Beyer - 05 Nov 2003 16:24 GMT
[2nd try]

> Hi Guys, I havn't done all that much of EJB. I had a basic question. If I am
> referencing one Entity bean from another, how does this get handled. Is the
> container smart enough to know that it doesn't need to passivate the entire
> referenced bean and only stores some kind of a reference from one bean to
> another.

"In JBoss, EJBs thus are a robust data cache for the web layers. A
typical web application will use servlet/JSP and your favorite portal
application to access the EJBs. Since EJBs carry their own optimized
caches, we would think that we can work at in-memory speed throughout
our stack. Unfortunately, by specification, the EJBs are remote and
require the usage of the pass by copy semantic. Serialization is back in
full force even as the web layer communicates directly with the EJB
container (Tomcat in JBoss is optimized in that way). The specification
deals with this in a very “spec heavy” way that requires you to use
local interfaces to achieve a very simple result. This is a clear case
of the spec gone wild, looping onto its own logic and patching
spec-created problems by adding yet another intrusive layer of
complexity in the application design. Local interfaces are a
“spec patch” not a first class citizen. In JBoss, we optimize away this
RPC layer, transparently and automatically to the EJB programmer."

from: http://www.jboss.org/modules/html/blue.pdf

Don't know how this is handled by other products ...

Marcus


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.