This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread 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


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.
 
GeeCON Prague 2014
 
subject: @OneToMany primary key part of foreign key