permaculture playing cards*
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 EJB 3 in Action this week in the EJB and other Java EE Technologies 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @OneToMany primary key part of foreign key
 
Similar Threads
Could not determine type for: java.util.Set
Adding associations to a join entity..
@PrimaryKeyJoinColumn: no insertable and no updatable
Primary key / Forign Key
How to map ManyToOne relationship with Composite key?