How to map unidirectional @OneToMany with embeddedId in Hibernate
Issue
- We are trying to map two entities, with a
@OneToManyassociation between two entities. - Class has a composite primary key, so we made an
@EmbeddedIdinside it. - How can we map in the right way a
@OneToMany relationship with CascadeType=ALL, in order to makeentityManager.persist(object)andentityManager.merge(object)working correctly? How to map these relationships in the right way, in order to make them work with persist and merge methods ofentityManager. - Is it not possible to make it work with a unidirectional mapping? @OneToMany on Customer object, but without @ManyToOne in Product?
Environment
- Red Hat JBoss Enterprise Application Platform
- 6.2.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.