[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Hibernate mapping for table associations with duplicate colu

ummerh do-not-reply at jboss.com
Fri Mar 2 11:00:03 EST 2007


We have a table design where child table (Program) has composite PRIMARY KEY(brandId,programId), it has a FOREIGN KEY(brandId) to table (Brand) and another FOREIGN KEY(brandId,programGroupId) to table(ProgramGroup). If you notice carefully here, you'll find that brandId is a repeated column in all the relationships. So when creating Java Objects we have to repeat the "brandId" in all the JPA annotations (@JoinColumn(name="BRD_BRAND")).

Since we repeat the column name, we are forced to use options (insertable=false, updatable=false) while defining the fields. This prevents us from saving the objects successfully with their relationships.

How can we resolve this? We would like to have these objects support "persist()" method.

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

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



More information about the jboss-user mailing list