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.