aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes entity bean relationship field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "entity bean relationship field" Watch "entity bean relationship field" New topic
Author

entity bean relationship field

Adela Popescu
Greenhorn

Joined: Oct 28, 2004
Posts: 18
Hello,
I don't understand why the type of a relationship field can only be a local component interface. What is if I have relationships between two entity beans with remote component interfaces? I cannot declare in this case cmr fields? How can I have a relation from one bean to another?
Please clarify me.

Many thanks,
Adela
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203
Because you cannot have a foreign key that references a table residing in a remote database. Its as simple as that.

A bean-to-bean relationship (in entity beans) boils down to table-to-table relationship. The cmr fields are fetched using table JOINS. You cannot join two tables that are physically residing on different machines.


Cheers.<br />Keerthi<br />(SCJP, SCWCD, SCBCD)
Binoj Viswanathan
Ranch Hand

Joined: Feb 25, 2003
Posts: 85
hi,
As EJB spec there shd not b ani r'ships involving remote enity objs. But some containers like Weblogic allow this.U can establish r'ships b/w remote entity objs but they must b running in same container and, of course, tables repd by the entity neans must b from DB.
Here the Weblogic uses pass by reference even tho u r using remote objs


binoj


SCJP 1.4(98%)<br />SCBCD1.3 (100%)<br />SCWCD 1.4 (93%)(w/o prep..n)
Adela Popescu
Greenhorn

Joined: Oct 28, 2004
Posts: 18
Many thanks for your answer. Keerthi, when the database must be on the same JVM, that means you can have a client on another machine accessing a remote bean and this bean is on the same JVM with my entity bean (the bean is the client for my entity bean).The entity bean accesses the database and has a cmr field to another entity bean. I have right? My problem was that I didn't understand that you can have a client on another JVM.
Binoj, it is very interesting that WebLogic can this.

Regards,
Adela
Keerthi P
Ranch Hand

Joined: Aug 19, 2003
Posts: 203
The database need not have to be in the same machine as the entity beans and in most cases it won't. But if two entity beans should relate, the corresponding tables should be in the same database which implies that the beans can only be local to each other.

Bean-A --> Table-A
Bean-B --> Table-B

Relating Bean-A and Bean-B using 'remote' interfaces would mean that Table-A and Table-B can also be remote from each other. But the semantic of table joins requires that the related tables are in the same database.

Of course some vendors likee BEA allow relating entity beans using their remote interface but as Binoj mentioned the beans should be in the same machine.
[ March 03, 2005: Message edited by: Keerthi P ]
Adela Popescu
Greenhorn

Joined: Oct 28, 2004
Posts: 18
Thank you very mach Keertky, now I understand.
Cheers,
Adela
 
Consider Paul's rocket mass heater.
 
subject: entity bean relationship field