This content has been marked as final.
Show 2 replies
-
1. Re: Confusion over em.refresh()?
fhh May 16, 2007 3:37 AM (in response to lowecg2004)Have you annotated the collection with CascadeType.REFRESH?
Regards
Felix -
2. Re: Confusion over em.refresh()?
lowecg2004 May 16, 2007 4:03 AM (in response to lowecg2004)Hi Felix,
Success!
Firstly apologies, I wrote "many-to-one" in my post. It is actually OneToMany (was quite late when I was writing ;)
On my collection I had specified CascadeType.ALL which includes CascadeType.REFRESH.@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "order") public Set<Address> getAddresses() { return this.addresses; }
Changing this to exclude REFRESH worked a treat!@OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REMOVE}, fetch = FetchType.LAZY, mappedBy = "order") public Set<Address> getAddresses() { return this.addresses; }
All my entities are code generated, which I suppose makes it easy to overlook some of the finer details.
Thanks for your help - greatly appreciated.
Chris.