This content has been marked as final.
Show 5 replies
-
1. Re: Cascade problem
cyril.joui May 8, 2006 11:42 AM (in response to armita)I have this code and it works fine :
@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, mappedBy="portfolio") public Collection<FinancialProduct> getFinancialProducts() { return financialProducts; }
Try to remove :@Column(unique = false, nullable=false) @Basic(fetch=FetchType.LAZY)
-
2. Re: Cascade problem
armita May 8, 2006 11:53 AM (in response to armita)"cyril.joui@supinfo.com" wrote:
I have this code and it works fine :@OneToMany(cascade = { CascadeType.PERSIST, CascadeType.REMOVE }, mappedBy="portfolio") public Collection<FinancialProduct> getFinancialProducts() { return financialProducts; }
Try to remove :@Column(unique = false, nullable=false) @Basic(fetch=FetchType.LAZY)
But the ollection is heavy and I need Lazy. What is your Jboss &EJB3 version? -
3. Re: Cascade problem
cyril.joui May 8, 2006 12:11 PM (in response to armita)Collections are always LAZY by default ... isn't it ?
I have tested it with JBOSS 4.0.4RC1 (EJB3 RC ... ?) and CR2 (EJB3 RC6) -
4. Re: Cascade problem
utdrew May 12, 2006 5:06 PM (in response to armita)I'm having the same problem. I have a OneToMany relationship and regardless of whether I remove an object from the relationship, clear all of the objects in the relationship or replace the relationship with a new empty set the changes are never propagated to the 'Many' table.
Here is how I have things mapped
In Test1.java:@OneToMany( fetch = FetchType.LAZY, mappedBy = "test1Id") public Set<Test2> getTest2s() { return this.test2s; }
In Test2.java:@ManyToOne(cascade = {}, fetch = FetchType.LAZY) @JoinColumn(name = "TEST1ID", unique = false, nullable = false, insertable = true, updatable = true) public Test1 getTest1() { return this.test1; }
I've also tried this with just having the primitive Id field in Test2 and no mapping at all but regardless of how I perform the operation it doesn't work. We're using Jboss 4.0.4 cr2
Anyone have an idea what is going on and/or how to fix it?
thanks,
Drew -
5. Re: Cascade problem
epbernard May 18, 2006 7:12 PM (in response to armita)true by the very definition of mappedBy