Discussion:
[Middlegen-user] Relation Table Relations
S***@agora.co.uk
2002-07-27 19:08:01 UTC
Permalink
Hi,

Can MiddleGen create Relation Table style relations for the entties? (and
if so how?)

(I'm using JBoss by the way)

Thanks,


Sean
Aslak Hellesoy
2002-07-28 01:37:02 UTC
Permalink
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
Peter Zhou
2002-07-28 02:06:02 UTC
Permalink
I think Sean's question is:
Can middlegen generate @ejb:relation in EJB for the relations among tables?

My answer is: middlegen1.0 cannot.

Peter Zhou

-----Original Message-----
From: Aslak Hellesoy [mailto:***@netcom.no]
Sent: Saturday, July 27, 2002 10:33 PM
To: ***@agora.co.uk; middlegen-***@lists.sourceforge.net
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
S***@agora.co.uk
2002-07-28 07:38:03 UTC
Permalink
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
Aslak Hellesøy
2002-07-28 12:23:02 UTC
Permalink
Post by Aslak Hellesoy
-----Original Message-----
Zhou
Sent: 28. juli 2002 05:51
Subject: RE: [Middlegen-user] Relation Table Relations
among tables?
My answer is: middlegen1.0 cannot.
Yes it can!
Post by Aslak Hellesoy
Peter Zhou
-----Original Message-----
Sent: Saturday, July 27, 2002 10:33 PM
Subject: RE: [Middlegen-user] Relation Table Relations
Hi Sean.
 
I don't understand your question. Can you be more technical?
 
Aslak
 
 -----Original Message-----
Sent: 27. juli 2002 23:06
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
_______________________________________________
middlegen-user mailing list
https://lists.sourceforge.net/lists/listinfo/middlegen-user
Aslak Hellesoy
2002-07-28 12:23:03 UTC
Permalink
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
S***@agora.co.uk
2002-07-29 06:46:02 UTC
Permalink
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 Hellesoy
One comment: You're saying that this kind of relation is "most commonly
used
Post by Aslak Hellesoy
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.
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
Aslak Hellesoy
2002-07-29 06:59:06 UTC
Permalink
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 Hellesoy
One comment: You're saying that this kind of relation is "most commonly
used
Post by Aslak Hellesoy
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.
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

Loading...