my dog learned polymorphism*
The moose likes Object Relational Mapping and the fly likes @PrimaryKeyJoinColumns does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "@PrimaryKeyJoinColumns does not work" Watch "@PrimaryKeyJoinColumns does not work" New topic
Author

@PrimaryKeyJoinColumns does not work

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580
Hello,

I have two tables "User" and "Adress" with an optional ONE-TO-ONE Relationship:

"User" has a composite key and Adress takes this composite key as its primary key:

USER:
------
ID_A (PK)
ID_B (PK)


ADRESS:
------
ID_A (PK, FK)
ID_B (PK, FK)


I mapped it like this:






Now, when I do a HQL-Query like:



Hibernate prints this sql:



So you see, the SQL is false, as it contains the "user0_.adressas adressid641_", but adress should be a relationship to the Adress-Table.

What is wrong with my mapping?

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @PrimaryKeyJoinColumns does not work
 
Similar Threads
@PrimaryKeyJoinColumn: no insertable and no updatable
OneToOne Bidirectional Using @PrimaryKerJoinColumn
mapping problem and joinColumns
OneToOne composite key
Could not determine type for: java.util.Set