Hi, 

I understand that the objects are no longer persistent after db.close()
is called, but is there any way to use them in a future transaction? 

Say I have a 1:N relationship, Person:Address.

If I have a Person object that was the result of an earlier transaction
say:

Person P = findPerson (1);

(In the findPerson() method, I get the database object, begin a
transaction, commit and close.)

If later on I want to create a new address for that person...

createAddress() {
...
        db.begin()
        Person P = findPerson(1);
        Address A = new Address();
        A.setStreet("My Street");
        ...
        A.setPerson(P)
        ...
        db.create(A);
        db.commit();
        db.close();
}

This doesn't work because Person P is no longer a persistent object
because its own tx has finished...

Am I handling the transactions at the wrong level, or missing something
else?

Regards,

Matthew.

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to