This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Object Relational Mapping and the fly likes @OneToMany primary key part of foreign key Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "@OneToMany primary key part of foreign key" Watch "@OneToMany primary key part of foreign key" New topic
Author

@OneToMany primary key part of foreign key

Frank VanOor
Ranch Hand

Joined: Jun 18, 2004
Posts: 49
I'm a newbe and have a simple @OneToMany relationship to build without using a Join-Table and where the PK of table 1 is part of the PK in table 2

table 1: Exchange , PK: id
table 2: ExchangeRetrievalDate, PK: exchangeId (Pk of Exchange) + date



Hibernate throws the following exception:

Caused by: org.postgresql.util.PSQLException: ERROR: relation "public.exchange_exchangeretrievaldate" does not exist
Frank VanOor
Ranch Hand

Joined: Jun 18, 2004
Posts: 49

The reason was that the DB column names had mixed uppercase lowercase characters, and hibernate can't cope with that. I changed all column names to lowercase, and all works fine.
 
Consider Paul's rocket mass heater.
 
subject: @OneToMany primary key part of foreign key