Hi Sean,
Can you:
1) Send me the DDL (SQL) for the tables in question?
2) Tell me about the cardinality AND directionality of all relations?
-Also please don't crosspost to middlegen-***@lists.sourceforge.net AND
middlegen-user-***@lists.sourceforge.net and turn off HTML in your mail
client if you can.
Cheers,
Aslak
-----Original Message-----
From: ***@Agora.co.uk [mailto:***@Agora.co.uk]
Sent: 29. juli 2002 10:44
To: Aslak Hellesoy
Cc: middlegen-***@lists.sourceforge.net;
middlegen-user-***@lists.sourceforge.net
Subject: RE: [Middlegen-user] Relation Table Relations
HI,
I've tried the many2many attribute, but for JBoss the tags produced aren't
correct. :-(
/**
* Returns a collection of related
uk.co.agora.hsbc.persistence.SurveyGroupLocal
*
* @return a collection of related
uk.co.agora.hsbc.persistence.SurveyGroupLocal
*
* @ejb.interface-method view-type="local"
*
* @ejb.relation
* name="SURVEY_GROUP-PERSON"
* role-name="person-has-survey_group"
* target-ejb="SurveyGroup"
* target-role-name="survey_group-has-person"
* target-multiple="yes"
*
* @debug M:N
*
* @jboss.relation
* fk-constraint="true"
* fk-column="PERSON_ID"
* related-pk-field="personId"
*
* @jboss.relation
* fk-constraint="true"
* fk-column="SURVEY_ID"
* related-pk-field="surveyId"
*
*/
When I should have something more like:
/**
* Get the SurveyGroup for this Person.
*
* @return The SurveyGroupLocal for this Person.
*
* @ejb.interface-method view-type="local"
* @ejb.relation
* name="person-surveygroup"
* role-name="one-person-belongsto-one-surveygroup"
* target-ejb="SurveyGroup"
* target-role-name="one-surveygroup-has-many-persons"
* target-multiple="yes"
*
* @jboss.relation-mapping style="relation-table"
* @jboss.relation-table table-name="SURVEY_GROUP_MEMBER"
* @jboss.relation
* related-pk-field="groupId" fk-column="GROUP_ID"
* @jboss.target-relation
* related-pk-field="personId" fk-column="PERSON_ID"
* @jboss.target-relation
* related-pk-field="surveyId" fk-column="SURVEY_ID"
*/
Post by Aslak HellesoyOne comment: You're saying that this kind of relation is "most commonly
used
Post by Aslak Hellesoyfor bi-directional many to many relationships". Aren't they *always*
m:n? -Or did you mean "always used for many to many relationships, most
commonly bi-directional ones". I'm not trying to be picky here, just
wondering if you're referring to a concept I'm unfamiliar with.
Relation tables aren't always used for M:N relations. Sometimes they are
used as 1:1 (so you may need a way of specifying that).
I also think that Dean Des Rosiers' ideas would be great.
Regards,
Sean
Aslak Hellesoy <***@netcom.no>
Sent by: middlegen-user-***@lists.sourceforge.net
28/07/2002 15:18
To: <***@agora.co.uk>
cc: <middlegen-***@lists.sourceforge.net>,
<middlegen-user-***@lists.sourceforge.net>
Subject: RE: [Middlegen-user] Relation Table Relations
I understand what you mean now.
Yes, Middlegen (CVS) does that if you set the many2many attribute of the
<middlegen> task to true. (It defaults to false). Here is a sniplet of the
docs under middlegen/docs/ant.html:
"Set this to true if you want Middlegen to detect many-to-many
relationships. If Middlegen stumbles upon three tables A, B and C where A
and C have many Bs, it will consider A-C a possible many-to-many
relationship where B is the join table."
The CMR examples you refer to in XDoclet were actually produced by Middlegen
;-)
One comment: You're saying that this kind of relation is "most commonly used
for bi-directional many to many relationships". Aren't they *always*
m:n? -Or did you mean "always used for many to many relationships, most
commonly bi-directional ones". I'm not trying to be picky here, just
wondering if you're referring to a concept I'm unfamiliar with.
Cheers,
Aslak
-----Original Message-----
From: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net]On Behalf Of
***@agora.co.uk
Sent: 28. juli 2002 11:36
To: Aslak Hellesoy
Cc: middlegen-***@lists.sourceforge.net;
middlegen-user-***@lists.sourceforge.net
Subject: RE: [Middlegen-user] Relation Table Relations
Hi,
There are 2 styles of relations that can be defined between Entity beans
(how you do it is container specific).
The first is via Foreign Keys, i.e. The table for one bean has a column(s)
that represent the primary key(s) of the related bean and its table.
The other is via a sperate Relation Table - one that has no coresponding
entity bean. This relation table basically contains primary key information
linking the two beans and is most commonly used for bi-directional many to
many relationships. The XDoclet ejb cmr example illustrates all this very
nicely.
They are catered for in XDoclet 1.1 for Websphere, and now for JBoss 3 in
XDoclet 1.2 (the CVS head version).
Regards,
Sean
Aslak Hellesoy <***@netcom.no>
Sent by: middlegen-user-***@lists.sourceforge.net
28/07/2002 04:33
To: <***@agora.co.uk>,
<middlegen-***@lists.sourceforge.net>
cc:
Subject: RE: [Middlegen-user] Relation Table Relations
Hi Sean.
I don't understand your question. Can you be more technical?
Aslak
-----Original Message-----
From: middlegen-user-***@lists.sourceforge.net
[mailto:middlegen-user-***@lists.sourceforge.net]On Behalf Of
***@agora.co.uk
Sent: 27. juli 2002 23:06
To: middlegen-***@lists.sourceforge.net
Subject: [Middlegen-user] Relation Table Relations
Hi,
Can MiddleGen create Relation Table style relations for the entties? (and
if so how?)
(I'm using JBoss by the way)
Thanks,
Sean
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf