File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes Issues with @PrimaryKeyJoinColumn Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Issues with @PrimaryKeyJoinColumn" Watch "Issues with @PrimaryKeyJoinColumn" New topic

Issues with @PrimaryKeyJoinColumn

anagha desai

Joined: May 08, 2008
Posts: 22
Facing issues with the above annotation .

Reading "Mannings in action book for ejb3 " and trying out a few examples

This is a Master Child relation with Child containing the FK
The FK in Child is also the PK for that Table

So from my understanding we need to use :: @PrimaryKeyJoinColumn

However I get the following exception ::

Thanks ,
R Sawant
Ranch Hand

Joined: Aug 08, 2005
Posts: 51
Faced this issue in last week while reading the same book.. figured out how to do this... giving the full sample code for mapping

Important point to note the usage of "GenericGenerator". Just google for this if you need more info. Hope this helps. Thanks


If you think you can, you can. If you think you can't, you are right.
subhanair girish

Joined: Aug 12, 2008
Posts: 13
please help me with the hibernate one to one mapping.

user_id = PK of loginform
identification_no = PK of partnerform, FK of loginform

the exceptions listng
Aram Nigiyan

Joined: Mar 23, 2010
Posts: 1
thanks, Ramdas Sawant, working example you posted helped me very much.
I agree. Here's the link:
subject: Issues with @PrimaryKeyJoinColumn
It's not a secret anymore!