[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
[eclipselink-users] JPA OneToOne with Primary Key FK Question
|
- From: "Tim Hollosy" <hollosyt@xxxxxxxxx>
- Date: Tue, 17 Jun 2008 16:58:24 -0400
- Delivered-to: eclipselink-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=+lW15ifm6HHZ4Tr1ft8m9AuG0zP0/htHIQaAVMWnkt4=; b=EdRzCA58rVeljwBZ8uAcb+cDxcViEaKIPwGqFwhT4f9O6bk7B5lOXgxjFTDaNjw61W lwEy4/ose/DkDwMcZod5ibyoD7gk5FGC5Y0eVoaA1J5x+MVttJRKOl7wkkAGver0z86h 51jUDmo22VY+SbiBUEovMxLlEXdjPowm36SCI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=f4036XJg0J++LF5jnGay+c2921b9qREQNgGaIWGeOwtcC4abJKohL4x3mlSwvTssrJ y9k48QNE+IN+EjgV21Dd/b3HuT+k/NwLZy6lIBGPPEuLJF3XPBV0rhpyOc47baHiGtf4 Ji0p8XmPJkIJJvCUpMBdEY9HmKNPheB4lv9OY=
I'm having a hard time with a OneToOne with a Primary Key as Foriegn
Key relationship.
The secondary table is not getting the PK set, it's going in as null,
instead of grabbing
Here's the EO's.
Account and AccountDetails
They both share account_id as PK's.
I set the relationships on both sides and persist the account object,
the insert on the account_details fails with a null account_id.
Account
---
public class Accounts extends CreatedByModifiedByBaseEntity implements
Serializable {
@Id
@GeneratedValue(generator="ACCOUNT_ID_SEQ",strategy=GenerationType.SEQUENCE)
@SequenceGenerator(name="ACCOUNT_ID_SEQ",sequenceName="crm.\"ACCOUNT_ID_SEQ\"",allocationSize=1)
@Column(name="account_id")
private Long accountId;
@OneToOne(mappedBy="accountId",cascade=PERSIST)
private AccountDetails accountDetails;
Account_Details
---
public class AccountDetails extends ModifiedByBaseEntity implements
Serializable {
@Id
@Column(name="account_id")
private Long accountId2;
@OneToOne
@PrimaryKeyJoinColumn
private Accounts accountId;
--
./tch