Hi everyone!
Well I hope someone has soms suggestions for my problemen. I'm struggeling with it for several weeks now, and tried every solution i could think of.
Persisting object with collections is not a problem, but when i try to update a collection, hibernate seems to ignore de updated data. I know you have explicitly tell hibernate to also update collection, but still than it doesn't seem to work. Here my entity classes:
entity Form:
Code:
[...]
@ManyToMany(cascade = CascadeType.MERGE, fetch = FetchType.EAGER)
@JoinTable(name = "form_theme", catalog = "webloket_dji", joinColumns = { @JoinColumn(name = "forms_ID", nullable = false, updatable = true) }, inverseJoinColumns = { @JoinColumn(name = "themeList_ID", nullable = false, updatable = true) })
private Set<Theme> themeList;
[...]
[...]
entity Theme:
Code:
@ManyToMany(mappedBy="themeList", cascade=CascadeType.MERGE, fetch=FetchType.EAGER)
@Cascade(org.hibernate.annotations.CascadeType.SAVE_UPDATE)
private Set<Form> forms;
[...]
how i call the merge method:
Code:
@Transactional
public Form update(Form form) {
logger.debug("Updating form with id: " + form.getId());
logger.debug("Number of Themes in form: " + form.getThemeList().size());
logger.debug("Number of Chars in form: " + form.getSearchChars().size());
return getJpaTemplate().merge(form);
}