This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Reply 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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: One to one relationship with same column name
 
Similar Threads
Question on Sets of Objects
Problem in <one-to-one> relation mapping
Fetch only one column using hibernate 3.0
Hibernate parent/child and foreign key relationships mapping
Repeated updates on EVENT table, in Hibernate one to many mapping