This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes CMR in entity bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "CMR in entity bean" Watch "CMR in entity bean" New topic
Author

CMR in entity bean

Deepa Malhotra
Greenhorn

Joined: Oct 31, 2003
Posts: 19
Lets say I have EMPLOYEE table and a DEPT table. EMPLOYEE table has the deptid which is the foreign key. And I can establish CMR between the two entity beans.
If EMPLOYEE table does not have deptid column (ie there is no common columns between tables) can I still establish a CMR between the two entity beans?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

If EMPLOYEE table does not have deptid column (ie there is no common columns between tables) can I still establish a CMR between the two entity beans?

It is not possible to establish the relation since employee does not know the department and the departement is not even null , it does not just exist.


Groovy
Deepa Malhotra
Greenhorn

Joined: Oct 31, 2003
Posts: 19
Thanks Preadeep.
But if you look at the CMP example in Sun's tutorial, we have a Teams entity bean and a League entity bean. The underlying tables do not have any common columns, but the beans have a 1:* relationship established thro CMR.
Am I making sense?
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8904

Can you please pass the link to the tutorial. I checked the j2ee 1.3 tutorial but did not mention of Leage entity. It was just Team and Player entities.
Bill Dudney
Author
Ranch Hand

Joined: Sep 05, 2003
Posts: 234
Hi All,
Is it possible that this is a *:* relationship and there is an association table between them? That seems to make sense (a team could be in more than one league).
Hope this helps.


TTFN,<br /> <br />-bd-<br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/0471449156/qid=1064343733/sr=2-1/ref=sr_2_1/002-8375300-3666449" target="_blank" rel="nofollow">Jakarta Pitfalls</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471146153/qid=1064343733/sr=1-2/ref=sr_1_2/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">J2EE AntiPatterns</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471462071/qid=1064343733/sr=1-3/ref=sr_1_3/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">Mastering JavaServer Faces</a> | <a href="http://bill.dudney.net/roller/page/bill" target="_blank" rel="nofollow">Blog</a> | <a href="http://www.jroller.com/page/BillDudney" target="_blank" rel="nofollow">Eclipse Blog</a> | <a href="http://www.sourcebeat.com/TitleAction.do?id=2" target="_blank" rel="nofollow">Eclipse 3 Live</a>
Deepa Malhotra
Greenhorn

Joined: Oct 31, 2003
Posts: 19
Here is the link for that tutorial:
http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/CMP.html
League and Teams have 1:* relationship. One League can have many teams and every team just belongs to League.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: CMR in entity bean
 
Similar Threads
simple example implementation?
CMR
using views for entity beans not cmr(am i right?)
CMP - CMR for the same field?
JPA ManyToOne Mapping Question