Can you include a code sample of what you are doing? But it sounds like you want both B1 and B2 refering to A1, right?
What happends if you load A1 before adding it to B2? Does that help?
On Sun, 2002-01-20 at 08:53, Eduard Mossinkoff wrote:
> Howdy
>
> I have reduced the problem I experience to the bare essentials. Let me
> elaborate.
> Two simple classes called 'A' and 'B'. Both classes have an 'id' of type
> String. The 'id' is generated by the UUID key-generator. I can persist
> instances of 'A' and 'B' without problems.
> Now 'B' has a reference to 'A' and therefor 'B' depends on 'A'. Type 'B'
> has a property called 'a' of type 'A'.
> If, in a single transaction, I create an instance of 'A', called 'a1'
> and an instance of 'B', called 'b1'. Then 'b1' receives a reference to
> 'a1'. The transaction is committed and without problems so far.
>
> Now, I want to have a new instance of type 'B', called 'b2' associated
> with the persistent instance 'a1' of type 'A'. I retrieve 'a1' from the
> database and associate 'b2' with 'a1'. The assertions in my TestSuite
> assures me that 'b1.a' is referring to 'a1'. Then when the transaction
> is committed, a NULL is inserted for the property 'a' which holds a
> reference to 'a1'. Instead of storing the 'id' of 'a1', a NULL is
> inserted.
>
> The problem is derived from a larger complex meta-model repository, so I
> leave out all the irrelevant bits and pieces.
>
> It would be great if someone can help me out. Is it my understanding or
> really a bug, that is what I would like to know.
> Thanks,
> Eduard.
>
>
> _________
> class A {
> public String id;
> ..
> }
>
> class B {
> public String id;
> public A a;
> ..
> }
>
> create table A (
> id varchar(30) not null,
> primary key ( id )
> );
>
> create table B (
> id varchar(30) not null,
> a_id varchar(30) not null,
> primary key ( id ),
> foreign key (a_id) references A (id)
> );
>
>
> <class name="A" identity="Id" key-generator="UUID">
> <map-to table="A" xml="A" />
> <field name="id" required="true" direct="true">
> <sql name="id" />
> <bind-xml name="id" node="attribute"/>
> </field>
> </class>
>
> <class name="B" identity="Id" key-generator="UUID">
> <map-to table="B" xml="B" />
> <field name="id" required="true" direct="true">
> <sql name="id" />
> <bind-xml name="id" node="attribute"/>
> </field>
> <field name="a" type="A" required="true" direct="true">
> <sql name="a_id" dirty="check" />
> <xml name="a" node="element" />
> </field>
> </class>
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
> unsubscribe castor-dev
--
Virtually,
Ned Wolpert <[EMAIL PROTECTED]>
D08C2F45: 28E7 56CB 58AC C622 5A51 3C42 8B2B 2739 D08C 2F45
msg04390/pgp00000.pgp
Description: PGP signature
