This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "@PrimaryKeyJoinColumns does not work" Watch "@PrimaryKeyJoinColumns does not work" New topic

@PrimaryKeyJoinColumns does not work

nimo frey
Ranch Hand

Joined: Jun 28, 2008
Posts: 580

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:



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:
subject: @PrimaryKeyJoinColumns does not work
It's not a secret anymore!