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

NigelWhite do-not-reply at jboss.com
Wed Jun 13 07:32:15 EDT 2007


I'm trying to pull in columns from two tables.

Most of the columns work fine - they are simple columns, and I can specify which table they come from.

The trouble is when one of the properties on the secondary table is an @ManyToOne association.

There's no way of informing the persistence provider (We're using Hibernate 3.2 on JBoss 4.2.0.GA) through that annotation that this column is on the secondary table.

I get 


  | javax.servlet.ServletException: org.hibernate.AnnotationException: @Column(s) not allowed on a @ManyToOne property: com.aspicio.entity.base.ContactPerson.player
  | 

If I use


  | @column(table="ContactDetails")
  | @ManyToOne(fetch=FetchType.LAZY, optional = false)
  | private Player player;
  | 


Do I just have to map this as an unlinked key:


  | @column(table="ContactDetails", name="player_id")
  | private Long playerId;
  | 

and add a hand-coded getter which explicitly fetches the associated Player entity??

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

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



More information about the jboss-user mailing list