aspose file tools*
The moose likes Object Relational Mapping and the fly likes One to one relationship with same column name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "One to one relationship with same column name" Watch "One to one relationship with same column name" New topic
Author

One to one relationship with same column name

Eric Juneau
Greenhorn

Joined: Jul 13, 2009
Posts: 28
I have a situation where I have a person and a car. Every person has one car. Every car has one person. The Person table has a primary key called PERSON_ID. This is also the name of the column in the Car table that is the foreign key reference.

The problem is that it returns a "Repeated column in mapping for entity" on startup. It appears hibernate is getting confused about the fact that there's a PERSON_ID in the Person mapping file and I'm referencing the same column name in my "many-to-one" tag. It appears to think I'm referencing Person.PERSON_ID instead of Car.PERSON_ID. It says I can fix it by adding update=false and insert=false, but I want to be able to update Car. Is there a way to indicate what table I mean?

This is what's in the Person mapping file:
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: One to one relationship with same column name