Bugs item #568978, was opened at 2002-06-14 12:55
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=568978&group_id=22866
Category: JBossCMP
Group: v3.0 Rabbit Hole
Status: Open
Resolution: None
Priority: 5
Submitted By: Matthew French (mfrench42)
Assigned to: Nobody/Anonymous (nobody)
Summary: CMR foreign key not a primary key
Initial Comment:
There does not seem to be any way to have a container
managed relationship IF the foreign key does not
reference the primary key of the other EJB.
I have a CMP entity EJB "project" that references a
similar EJB "user". (One2Many: User-has-Projects)
Table user:
ID int not null primary key
UID varchar(16) not null unique
Name varchar(255)
Table project:
ID int not null primary key
Owner varchar(16) references user.UID
Description varchar(255)
Although user.ID is the primary key and is used by other
EJB's, "project" references the UID field for historical
reasons.
First problem is that the CMP engine does not detect
that the primary and foreign keys are the wrong data
type.
Second problem is that I cannot find any way to
describe this in the deployment descriptor:
<key-field>
<field-name>id</field-name>
<column-name>Owner</column-name>
</key-field>
Works, if Owner is an integer. But:
<key-field>
<field-name>uid</field-name>
<column-name>Owner</column-name>
</key-field>
does not work, I get an error message:
"CMP field for key not found: field name=uid"
I am assuming that <field-name> is the "one" side of the
relationship, and <column-name> is on the "many" side.
In short, there does not seem to be any way to have a
bidirectional many-to-one relationship when the foreign
key does not reference the primary key of the remote
object.
This would be a useful feature for situations where the
database schema already exists and cannot be
changed.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=376685&aid=568978&group_id=22866
_______________________________________________________________
Don't miss the 2002 Sprint PCS Application Developer's Conference
August 25-28 in Las Vegas -
http://devcon.sprintpcs.com/adp/index.cfm?source=osdntextlink
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development