The main change is not

    private List allA;
to
    private List allA = new ArrayList();

but the change of

    public void setAllA( List allA ) { this.allA = allA; }
to
    public void setAllA( List allA ) { this.allA.clear();
this.allA.addAll( allA ); }


> depends on the auto-delete settings in the collection-descriptor.

makes no difference. But if I change the setAllA method, then make diff...

I don't understand why... The only response I've found is if it's related to
CollectionProxies...


Edson Richter





----- Original Message ----- 
From: "Thomas Mahler" <[EMAIL PROTECTED]>
To: "OJB Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, June 18, 2003 3:02 AM
Subject: Re: M:N && Proxy


Hi Edson,

Edson Carlos Ericksson Richter wrote:
> 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!!!

depends on the auto-delete settings in the collection-descriptor.

> 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.

What do you expect? that only entries from the indirection table get
deleted? should be configurable with auto-delete="true|false".

> Appear that OJB is not correctly managing
> CollectionProxy elements in M:N non-decomposed (I've not tried manual
M:N).

what has the change from
private List allA;
to
private List allA = new ArrayList();
to do with proxies?

puzzled,
Thomas

> 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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---
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


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to