[jboss-user] [EJB 3.0] - Re: Confusion over em.refresh()?

lowecg2004 do-not-reply at jboss.com
Wed May 16 04:03:48 EDT 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4046034#4046034

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4046034



More information about the jboss-user mailing list