[jboss-user] [EJB 3.0] - Re: @SecondaryTable

NigelWhite do-not-reply at jboss.com
Wed Jun 13 11:00:25 EDT 2007


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 get


  | org.hibernate.AnnotationException: SecondaryTable JoinColumn cannot reference a non primary key
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054020#4054020

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054020



More information about the jboss-user mailing list