-
1. Re: Foreign key fields mapped to primary key fields in JBoss
tolborg Jan 16, 2003 12:48 PM (in response to aloubyansky)I would like an answer to this question too.
-
2. Re: Foreign key fields mapped to primary key fields in JBoss
tolborg Jan 17, 2003 3:32 AM (in response to aloubyansky)WebSphere Appserver 5 and WSAD5 does it this way.
I have enclosed a zip file with two EJBS - AlphaBean and BetaBean.
Please consider if this is the way JBoss is going to implement foreign keys mapped to primary keys.
If you look carefully you'll notice that WebSphere uses the actual NAMES of the foreign keys and implements them as cmp fields.
The database tables used in this example are like this:
Tables:
ALPHA
aid (pk)
name
BETA
aid (pk and foreign key to Alpha.aid)
bia (pk)
name
The foreign key is named (f_alpha1) -
3. Re: Foreign key fields mapped to primary key fields in JBoss
tolborg Jan 17, 2003 3:41 AM (in response to aloubyansky)Hmm... where did that zip file go. I'll try again
-
4. Re: Foreign key fields mapped to primary key fields in JBoss
tolborg Jan 17, 2003 4:03 AM (in response to aloubyansky)When I wrote that "I would like and answer to this question too" I has misunderstood your post. Its not a question - its a pointer on how to "do it".
What I don't understand is that this seems to mean that different containers does this in different ways which breaks portability.
Could you please give me a small example on how to do this. Especially the "Relationships are assigned between ejbCreate and ejbPostCreate" I don't understand. -
5. Re: Foreign key fields mapped to primary key fields in JBoss
juhalindfors Jan 28, 2003 3:37 AM (in response to aloubyansky)> Especially the "Relationships are assigned
> between ejbCreate and ejbPostCreate" I don't
> understand.
"This means that relationships are accessible in ejbPostCreate and not in ejbCreate."
It is work performed by the container in between the two methods to establish the relationship. -
6. Re: Foreign key fields mapped to primary key fields in JBoss
gianluca Jan 28, 2003 10:41 AM (in response to aloubyansky)I'm specially interested on how to do this :
> It's possible to map foreign key fields in
> one-to-many and one-to-one
> relationships to the primary key fields. All is
> needed is to assign the same
> names to the corresponding foreign and primary key
> fields.
What primary key field name and primary key class do you use if you implement a relation like this ?
The entity primary key should be made of its primary key field (if any) and one or more mapped foreign keys fields. How do you represent this in the ejb-jar.xml ?
How will the findByPrimaryKey() work ?
How to you define this kind of relationship in the jbosscmp-jdbc.xml deployment descriptor ?
Do you have a working sample of all this ?
Thanks in advance.