geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Aufdencamp <>
Subject RE: EJB 2.1 CMR Bi-Directional with Compound Key
Date Thu, 31 May 2007 01:16:10 GMT
Thanks for the help guys.&nbsp; I got it to deploy and the queries look right this time.&nbsp;&nbsp;
I need to test the relationships tomorrow, but it looks a lot better this week than it did
last week!:)<BR>
<DIV name="wmMessageComp">
<BLOCKQUOTE style="PADDING-LEFT: 8px; MARGIN-LEFT: 8px; BORDER-LEFT: blue 2px solid" webmail="1">--------
Original Message --------<BR>Subject: Re: EJB 2.1 CMR Bi-Directional with Compound Key<BR>From:
Dain Sundstrom &lt;;<BR>Date: Wed, May 30, 2007 7:21 pm<BR>To:<BR><BR><PRE>
I also suggest you skip CMP and move directly to JPA.  Knowing CMP 

isn't going to help you lean JPA at all.


On May 30, 2007, at 1:17 PM, Jay D. McHugh wrote:

&gt; Mark,
&gt; I thought about suggesting that you use JPA, but I wasn't sure if  
&gt; there was a reason 'bigger than you' that was requiring you to use  
&gt; EJB2.
&gt; I tried to learn how to use EJB2 entity beans and I was defeated.
&gt; I am _very_ glad that OpenJPA is integrated into Geronimo now - It  
&gt; is making my life much easier.
&gt; If you have any questions once you start working with it I'd be  
&gt; happy to answer any questions you have (if I can).
&gt; (BTW: Thanks to any and every one who had a part in getting JPA  
&gt; working in Geronimo!)
&gt; Jay
&gt; Mark Aufdencamp wrote:
&gt;&gt; Thanks for the response Gianny.  I've wacked out a small demo that  
&gt;&gt; I'm working on right now with a session facade, the three beans,  
&gt;&gt; and the database tables.  I'll let you all know how it goes:)
&gt;&gt;  I'm planning on hittting EJB 3.0 hard once I understand this.  I  
&gt;&gt; want to comprehend the legacy way first!
&gt;&gt;     -------- Original Message --------
&gt;&gt;     Subject: Re: EJB 2.1 CMR Bi-Directional with Compound Key
&gt;&gt;     From: Gianny Damour &lt;<A onclick="Popup.composeWindow('pcompose.php?');
return false;" href=";type=reply&amp;folder=INBOX.Apache.Geronimo.Users&amp;uid=119#Compose">gianny.damour<B></B></A>&gt;
&gt;&gt;     Date: Wed, May 30, 2007 7:07 am
&gt;&gt;     To: <A onclick="Popup.composeWindow('pcompose.php?');
return false;" href=";type=reply&amp;folder=INBOX.Apache.Geronimo.Users&amp;uid=119#Compose">user<B></B></A>
&gt;&gt;     Hi Mark,
&gt;&gt;     I had a look to the openejb-jar DD and I think you need to  
&gt;&gt; drop the      &lt;foreign-key-column-on-source/&gt; element from
&gt;&gt; Committee-     CommitteeMembers relation. This optional element  
&gt;&gt; means that the      foreign key columns declared in the following  
&gt;&gt; &lt;cmr-field-mapping&gt;      elements are defined by the CMP declared
&gt;&gt; by &lt;relationship-role-source&gt;.
&gt;&gt;     So, this should work:
&gt;&gt;     &lt;ejb-relation&gt;
&gt;&gt;        &lt;ejb-relation-name&gt;Committee-CommitteeMembers&lt;/ejb-relation-

&gt;&gt; name&gt;
&gt;&gt;        &lt;ejb-relationship-role&gt;
&gt;&gt;          &lt;ejb-relationship-role-name&gt;Committee-has-many- 
&gt;&gt; CommitteeMembers&lt;/     ejb-relationship-role-name&gt;
&gt;&gt;          &lt;relationship-role-source&gt;
&gt;&gt;            &lt;ejb-name&gt;CommitteeEntity&lt;/ejb-name&gt;
&gt;&gt;          &lt;/relationship-role-source&gt;
&gt;&gt;          &lt;cmr-field&gt;
&gt;&gt;            &lt;cmr-field-name&gt;committeeMembers&lt;/cmr-field-name&gt;
&gt;&gt;          &lt;/cmr-field&gt;
&gt;&gt;          &lt;role-mapping&gt;
&gt;&gt;            &lt;cmr-field-mapping&gt;
&gt;&gt;              &lt;key-column&gt;CommitteeId&lt;/key-column&gt;
&gt;&gt;              &lt;foreign-key-column&gt;CommitteeId&lt;/foreign-key-column&gt;
&gt;&gt;            &lt;/cmr-field-mapping&gt;
&gt;&gt;          &lt;/role-mapping&gt;
&gt;&gt;        &lt;/ejb-relationship-role&gt;
&gt;&gt;     &lt;/ejb-relation&gt;
&gt;&gt;     Also, you do not need to declare both sides of a relationship:  
&gt;&gt; the      above is enough to declare the CMR mapping for the  
&gt;&gt; Committee-     CommitteeMembers relation.
&gt;&gt;     BTW, I strongly recommend you to upgrade to OpenEJB3: this  
&gt;&gt; should be      a seamless migration from a CMP perspective as the  
&gt;&gt; OpenEJB guys have      done a fantastic work at writing an  
&gt;&gt; OpenEJB2 schema converter.
&gt;&gt;     Thanks,
&gt;&gt;     Gianny
&gt;&gt;     On 30/05/2007, at 1:07 AM, Mark Aufdencamp wrote:
&gt;&gt;     &gt; I could really use some help on this!  I have a two Entity 

&gt;&gt; beans      &gt; with a bi-directional relationship, committees  
&gt;&gt; and      &gt; committee_members.  Committees has a single field  
&gt;&gt; primary key of      &gt; committeeId.  Committee_members has a  
&gt;&gt; compound primary key of      &gt; CommitteeId+UserId.  A Foreign Key
&gt;&gt; constraint has been defined for      &gt; the committee_members table
&gt;&gt; based on the committeeId.  I can't seem      &gt; to get this to  
&gt;&gt; deploy and believe it's my openejb-jar.xml      &gt; deployment  
&gt;&gt; descriptor in the &lt;relationship&gt; section.  I've looked    
 &gt; at  
&gt;&gt; examples from JBoss and Sun, so I'm fairly certain my ejb-     &gt; 

&gt;&gt; jar.xml is correct.
&gt;&gt;     &gt;
&gt;&gt;     &gt; Does anyone have a working example of a bi-directional  
&gt;&gt; relatioship      &gt; where the many table has a compound key that I
&gt;&gt; can take a look at?
&gt;&gt;     &gt;
&gt;&gt;     &gt; Where can I find documentation on how OpenEJB and TranQL  
&gt;&gt; interact      &gt; to create the O/R map?
&gt;&gt;     &gt;
&gt;&gt;     &gt; This knowledge are really seems to be lacking documentation
&gt;&gt; in      &gt; Geronimo.  I'd really like to draw some pretty pictures
&gt;&gt; of tables      &gt; and beans with the seven different relationship 

&gt;&gt; types defined for      &gt; EJB 2.1.  This would be good preliminary
&gt;&gt; work for documenting EJB      &gt; 3.0 examples.  Please help me  
&gt;&gt; learn, so I can contribute:)
&gt;&gt;     &gt;
&gt;&gt;     &gt; TIA,
&gt;&gt;     &gt; Mark Aufdencamp
&gt;&gt;     &gt; <A onclick="Popup.composeWindow('pcompose.php?');
return false;" href=";type=reply&amp;folder=INBOX.Apache.Geronimo.Users&amp;uid=119#Compose">Mark<B></B></A>
&lt;<A href="" target=_blank></A>

&gt;&gt; pcompose.php? 
&gt;&gt; aEmlPart=0&amp;type=reply&amp;folder=INBOX.Apache.Geronimo.Users&amp;uid=108#Comp

&gt;&gt; ose&gt;


View raw message