Hi! I've discovered a bug in M:N relationships and proxys.
To give some light about the problem, if I have two classes
class A {
private Integer id;
private String description;
public Integer getId( ) { return id; }
public void setId( Integer newId ) { this.id = newId; }
public String getDescription( ) { return this.description; }
public void setDescription( String newDesc ) { this.description =
newDesc; }
}
class B {
private Integer id;
private List allA;
public Integer getId( ) { return id; }
public void setId( Integer newId ) { this.id = newId; }
public void setAllA( List allA ) { this.allA = allA; }
public void getAllA( ) { return this.allA; }
}
Now, I create a non-decomposed M:N relationship. Then if I delete an
element with
B b = new B();
b.getAllA( ).remove( 0 );
OJB removes the A object from the indirection table AND from A table!!!
Now, if I change to:
class B {
private Integer id;
private List allA = new ArrayList();
public Integer getId( ) { return id; }
public void setId( Integer newId ) { this.id = newId; }
public void setAllA( List allA ) { this.allA.clear(); this.allA.addAll(
allA ); }
public void getAllA( ) { return this.allA; }
}
OJB works as expected. Appear that OJB is not correctly managing
CollectionProxy elements in M:N non-decomposed (I've not tried manual M:N).
Can you confirm this?
Thanks,
Edson Richter
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.490 / Virus Database: 289 - Release Date: 16/6/2003
smime.p7s
Description: S/MIME cryptographic signature
