Hi
I am no expert and it has been a few months since I used the ODMG API.
Try this ---
Customer customer = new Customer("no", "one", "here", 0, "", 2, new Date());
for (int i = 0; i < 3; i++)
{
customer.addSchein(new Certificate("%PS1\n", customer));
}
Transaction tx = odmg.newTransaction();
tx.begin();
tx.lock(customer, Transaction.WRITE);
tx.commit();
I think the problem may be that you have persisted to the database in the
first iteration of the loop. The subsequent iterations will not persist
the added certificates.... you need to persist those.
If you still have no joy could you provide the mappings of the classes that
you have defined? It may help others point to the problem if my guess is
not correct :-)
HTH
Shane
> -----Original Message-----
> From: Gunnar Hilling [mailto:[EMAIL PROTECTED]
> Sent: Thursday, 9 October 2003 12:57 p.m.
> To: [EMAIL PROTECTED]
> Subject: Collections/ODMG
>
> Hello!
>
> Why does the following Code:
>
> Customer customer=new Customer("no", "one", "here",0, "", 2, new Date());
> for(int i=0; i<3; i++){
> Transaction tx = odmg.newTransaction(); tx.begin();
> tx.lock(customer, Transaction.WRITE); customer.addSchein(new
> certificate("%PS1\n", customer)); tx.commit();
> }
>
> only write 1 instance of certificate to the db?
>
> Any Help greatly appreciated,
>
> -Gunnar
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]