Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User Help »

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

scott.stark@jboss.org

2007-06-13


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=@(protected)",
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
_______________________________________________
jboss-user mailing list
jboss-user@(protected)
https://lists.jboss.org/mailman/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.