• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

@PrimaryKeyJoinColumns does not work

 
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
I don't always make ads but when I do they're tiny
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic