I knew that as soon as I send the message I would get it working and it happened, I should have sent it 2 days ago. Anyway it is now working but I don't really know what I did, that is frustrating also.
---
Dru Devore
-------- Original Message --------
Subject: Relationships
From: Dru Devore <ddevore@duckhouse.us>
Date: Wed, February 20, 2008 11:51 am
To: persistence@glassfish.dev.java.net
I am having a hard time getting a relationship correct. I know it can't be as hard as it appears or JPA would never have been approved. Anyway I have 2 tables a parent and a child both with unique IDs and a secondary field, a varchar, which defines the relationship.
This is the important part of the layout.
Parent:
id (bigint primary)
entry_id (varchar(40))
otherField1
otherField2
...
Child:
id (bigint primary)
entry_id (varchar(40))
otherField1
otherField2
...
I need to create an Entity for each of these and have them linked via the entry_id.
Everything I have tried gives me one error or another which has left me with major frustration. I can get a parent child relationship working where the child contains a filed based on the primary key and is named parent_id (since the field I am using for the parent reference is parent it wants to tack on _id for table column name, is this right?)
Anyway I appreciate any help anyone can provide for this problem. A nice document of different reference scenarios would be nice. The project I am working on will have a lot of relationships that I am afraid will not be standard JPA forms.
Thanks
---
Dru Devore