Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@PrimaryKeyJoinColumns does not work

 
nimo frey
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic