Jose Maria wrote:
If this doesn't solve your problem, please let me know (then I will
try to reproduce your problem with a test-case).
I've done that. Setting auto-update/delete to 'none'. But it still fails.

I setup a local test case using the classes and mapping from your first post. When I run this test against the latest from SVN OJB_1_0_RELEASE branch the test run without failure. So your problem should be fixed in next version of OJB (if possible try to run your test against latest version from SVN OJB_1_0_RELEASE branch).

The only issue I detect is an illegal insert of object B while running

tx.begin();

// Create A and B objects and make persistent
A a = new A();
a.setId(new Integer(startId));
a.setName("Ten");
tx.lock(a, Transaction.WRITE);
B b = new B();
b.setId(a.getId());
b.setDescription("Detail");
a.getItems().add(b);
tx.lock(b, Transaction.WRITE);

// Delete A and B
database.deletePersistent(a);
database.deletePersistent(b);

tx.commit();

Seems that OJB detects the B object referenced by A and change the modification state to insert it (instead of ignoring it). Will fix this ASAP.

regards,
Armin


By the way, in the example below the data will never be written to
database, because you delete a and b before the first commit. Further
it's recommended to use Database.makePersistent(...) to persist new
objects.
http://db.apache.org/ojb/docu/tutorials/odmg-tutorial.html#Persisting+New+Objects

Yes, I know. This is only a test that I'm doing to try to solve the
problem. Why I make a new object and then delete it? We have some
applications in which users can create objects but can also delete them
if they want. After some operations they save the changes.

Thank you for the help.



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

Reply via email to