Loading...
Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon
TUTORIAL

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

JPAContainer: Problem with MasterDetailEditor

Mark Goldenstein
10 years ago Feb 20, 2012 3:19pm
Matti Tahvonen
10 years ago Feb 21, 2012 3:21pm

Hi,

Could you post how your Schedule and ScheduleItem classes have been built? That would help to check what is possibly going wrong.

The helper class used by the FieldFactory is rather generic, but it does counts on some attributes. I checked from a test app, and there OneToMany mapping had this kind of attributes. Without cascades updated referenced entities would need to be manually updated and the orphanRemovel=true removes entities that end up referring to no "master entity".

@OneToMany(mappedBy = "invoice", cascade=CascadeType.ALL, orphanRemoval=true)

BTW. Have you considered to use the ElementCollection annotation instead? I think that could suit for your case as well if you'd also change ScheduleItem to Embeddable (vs. Entity). You'd need less complex jpa parameters with that.

cheers,
matti

Mark Goldenstein
10 years ago Feb 21, 2012 8:53pm