• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

One to one relationship with same column name

 
Eric Juneau
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic