I've got a problem with following project. We've two classes: CustomerValue and AddressValue which are join one-to-many (Customer can have many Addresses), and I have one EJB3 bean which is responsible for transaction - putting elements into database. When I try to put some wrong data in AddressValue class (with null value), EJB does rollback but only for AddressValue entity, not for whole CustomerValue entity. CustomerValue is created at the begining, then I add AddressValue and do save() by EJB.
What should I do to do rollback for whole CustomerValue when in one of his part (eg AddressValue) will notify that it can't be added to DB (PersistanceException)?
I work on JBoss 5.0.0GA, Java 1.6.0_12-b04
Code with setting is attached bellow:
Thanks for help