wood burning stoves 2.0
The moose likes JBoss/WildFly and the fly likes one-to-one relationship Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "one-to-one relationship" Watch "one-to-one relationship" New topic

one-to-one relationship

Jolie Lee
Ranch Hand

Joined: May 08, 2005
Posts: 87
I want to create a one-to-one relationship for this two table,

- ItemId (auto increment)
- SoftwareId
- PackageId

- SoftwareId
- SoftwareName

this is my relationship in jbosscmp-jdbc.xml




I keep getting error "org.jboss.deployment.DeploymentException: Role 'packageitems-has-software' on Entity Bean 'SoftwarePackageItemsEJB' : CMP field for key not found: field name='softwareId'"

Is it true that only can define primary keys in <key-field>? if yes, then how should i join this two table?

pls advise.Thanks.

Jys<br /><a href="http://jy-s.com" target="_blank" rel="nofollow">http://jy-s.com</a><br /> <br />Trying my very best to learn java, please forgive me if i'm asking some really stupid questions.
norman richards
Ranch Hand

Joined: Jul 21, 2003
Posts: 367
Try putting the key-field on the software-belongs-to-packageitems side since the id belongs to that side of the relationship.

You should definitely check out chapter 7 of the book to learn how to configure persistence. We have a very similar example and offer this as simple explanation:

In JBoss, key fields for relationships are always defined on the
source side of the relationship, regardless of whether they are mapped as
foreign keys in another entity table or in a middle table. Although it may
seem slightly odd in this particular case, JBoss is very consistent.

It's slightly out of context, but I think it should make sense.
I agree. Here's the link: http://aspose.com/file-tools
subject: one-to-one relationship
It's not a secret anymore!