-
1. Re: @SecondaryTable
nigelwhite Jun 13, 2007 10:04 AM (in response to nigelwhite)I think the answer is
@ManyToOne(fetch=FetchType.LAZY, optional = false) @JoinColumn(table="ContactDetails", name="player_id") public Player getPlayer() { return player; } public void setPlayer(Player player) { this.player = player; }
-
2. Re: @SecondaryTable
nigelwhite Jun 13, 2007 11:00 AM (in response to nigelwhite)I'm trying the composite entity the other way round now.
I have a "Contact" entity which contains the contact details for a Person at a location. ie. job title, email, phone number etc.
The Contact links to the Person entity which contains personal details.
So on the Contact entity, there is an @ManyToOne Person. And so on the Contact table there is a person_id field pointing to the Person row.
I'm trying to have Contact as the primary Table, and pulling Person as the secondary table using
@SecondaryTable(name="Person",
pkJoinColumns=@PrimaryKeyJoinColumn(name="id",
referencedColumnName="person_id"))
It's just a basic join on person_id->Person.id, but the config doesn't like it, I getorg.hibernate.AnnotationException: SecondaryTable JoinColumn cannot reference a non primary key
-
3. Re: @SecondaryTable
memema Nov 29, 2007 11:35 AM (in response to nigelwhite)Hi. I have the same problem. Somebody found the solution or a workaround? thanks