geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Aufdencamp <m...@aufdencamp.com>
Subject RE: Openejb-jar and EJB 2.1 CMR Many-Many Example
Date Fri, 20 Apr 2007 18:09:04 GMT
<DIV name="wmMessageComp">David,</DIV>

<DIV name="wmMessageComp">&nbsp;</DIV>

<DIV name="wmMessageComp">
Any chance you could cut and paste me a One-To-Many Bi-Directional
example as well?&nbsp; I seem to only find Un-Directional Examples in my Googling:)</DIV>

<DIV name="wmMessageComp">&nbsp;</DIV>

<DIV name="wmMessageComp">Mark Aufdencamp</DIV>

<DIV name="wmMessageComp"><A href="mailto:Mark@Aufdencamp.com">Mark@Aufdencamp.com</A></DIV>

<DIV name="wmMessageComp"><BR><BR>&nbsp;</DIV>

<BLOCKQUOTE style="PADDING-LEFT: 8px; MARGIN-LEFT: 8px; BORDER-LEFT: blue 2px solid" name="wmMessageComp"
webmail="1">-------- Original Message --------<BR>Subject: Re: Openejb-jar and EJB
2.1 CMR Many-Many Example<BR>From: "David Carew" &lt;dccarew@gmail.com&gt;<BR>Date:
Fri, April 20, 2007 8:35 am<BR>To: user@geronimo.apache.org<BR><BR>
Here's a simplified version of the DB schema I used for a many to many
relationship between&nbsp; CMP Entity beans called Account and Customer<BR><BR>create
table customer<BR>(<BR>&nbsp; customerid integer not null,<BR>&nbsp;
title character(3) not null, <BR>&nbsp; firstname varchar(30) not null,<BR>&nbsp;
lastname&nbsp; varchar(30) not null,<BR>&nbsp; pin character(4) not null,<BR>&nbsp;
primary key (customerid)<BR>);<BR><BR><BR>create table account<BR>(
<BR>&nbsp;&nbsp; accid character(11) not null,<BR>&nbsp;&nbsp;
balance decimal(8,2) not null, <BR>&nbsp;&nbsp; interest decimal(5,3),<BR>&nbsp;&nbsp;
type varchar(60) not null,<BR>&nbsp;&nbsp; primary key(accid)<BR>);<BR><BR><BR>create
table custacct<BR>(<BR>&nbsp;&nbsp; customerid integer not null,<BR>&nbsp;&nbsp;
accid character(11) not null,<BR>&nbsp;&nbsp; primary key(customerid, accid),
<BR>
&nbsp;&nbsp; foreign key(customerid) references customer ON DELETE
RESTRICT,<BR>
&nbsp;&nbsp; foreign key(accid) references account ON DELETE
RESTRICT<BR>);<BR><BR><BR>Here's the corresponding snippet from my
openejb-jar.xml file<BR><BR>&nbsp; &lt;relationships&gt;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;ejb-relation&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;ejb-relation-name&gt;Accounts-Customers&lt;/ejb-relation-name&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;many-to-many-table-name&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
custacct <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/many-to-many-table-name&gt;<BR><BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;
 ejb-relationship-role&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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;&nbsp;
&lt;/ejb-relationship-role&gt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/ejb-relation&gt;<BR><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&lt;/relationships&gt;<BR><BR>

<DIV><SPAN class=gmail_quote>On 4/20/07, <B class=gmail_sendername>Mark
Aufdencamp</B> &lt;<A onclick="Popup.composeWindow('pcompose.php?sendto=mark%40aufdencamp.com');;
return false;" href="mailto:mark@aufdencamp.com" target=_blank> mark@aufdencamp.com</A>&gt;
wrote:</SPAN>

<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT:
rgb(204,204,204) 1px solid">

<DIV>Hi All,</DIV>

<DIV>&nbsp;</DIV>

<DIV>
I'm continuing my studies and have successfully deployed CMP Entity
Beans with some rudimentary QL.&nbsp; I'm now working on come container manged relationships
(CMR).&nbsp; I can't seem to find much documentation on the appropriate mapping of the
ejb-jar relationships to the openejb-jar definitions.&nbsp; Can someone provide some direction
to documentation on the openejb-jar mappings.&nbsp; In particulare, I'm working on a Many-To-Many
relationship.&nbsp; I have a 3rd NF Table structure and the Entity Beans, just need that
last bit of info on the openejb-jar mappings. </DIV>

<DIV>&nbsp;</DIV>

<DIV>Thanks,</DIV>

<DIV>&nbsp;</DIV>

<DIV>Mark Aufdencamp</DIV><SPAN class=sg>

<DIV><A onclick="Popup.composeWindow('pcompose.php?sendto=Mark%40Aufdencamp.com');;
return false;" href="mailto:Mark@Aufdencamp.com" target=_blank>Mark@Aufdencamp.com</A></DIV>

<DIV>&nbsp;</DIV>

<DIV>&nbsp;</DIV>

<DIV>&nbsp;</DIV></SPAN></BLOCKQUOTE></DIV><BR></BLOCKQUOTE>


Mime
View raw message