Make sure you use database that support transaction. Also,
make sure you have right setting if you嚙踝蕭re using
connection pooling.
I believe all test in JDO close the database, and they do
not have problem.
So, I assume it is the problem in your test case. Maybe you can consider start with a
test case and modify it for your use, instead of making a complete new one.
Thomas
-----Original Message-----
>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, September 19, 2001 1:03 PM
>To: [EMAIL PROTECTED]
>Subject: [castor-dev] JDO: unexpected results with create, remove an
>
>RE: [castor-dev]
JDO: unexpected results with create, remove and rollback
>
>Hi,
>
>I have resolved
issues 2 3 - it was a problem with my tests. However I still have these
problems:
>
>1) Rollback after
create is not successful.
>2) close()
doesn't work (see details below).
>
>Look forward to
your response. I also apologise for the HTML messages - Outlook was being a bit
stubborn but I seemed to have whipped it into shape now.
>
>Thanks,
>Brett
>
>-----Original
Message-----
>From: Brett
Porter
>Sent: Wednesday,
19 September 2001 4:58 PM
>To:
[EMAIL PROTECTED]
>Subject:
[castor-dev] JDO: unexpected results with create, remove and rollback
>
>Hi,
>I've just started
out with Castor (v0.9.3 web release), and while I have it working fine for the
core functionality, I've had the following problems:
>
>1) if I start a
transaction, create an object, then rollback, like so:
>db.begin();
>db.create(object);
>db.rollback();
>The object exists
- ie create is not rolled back.
>2) if I create an
object, commit the transaction, then create another with the same primary key,
it appears to succeed (no exception is thrown), but nothing is inserted into
the database. Sample code:
>
>object = new
MyObject( 1, test object );
>db.begin();
>db.create(object);
>db.commit();
>object = new
MyObject( 1, conflict object );
>db.begin();
>db.create(object);
-- expect org.exolab.castor.jdo.DuplicateIdentityException here
>db.commit();
>3) similarly to
above, if I remove an object then try and remove it again, it doesn't throw an
exception
>db.begin();
>object = db.load(
MyObject.class, new Integer( 6 ));
>db.remove( object
);
>db.commit();
>object = new
MyObject( 1, conflict object );
>db.begin();
>object = db.load(
MyObject.class, new Integer( 6 )); -- expect org.exolab.castor.jdo.ObjectNotFoundException
here
>db.remove(object);
>db.commit();
>It appears to me
that some changes aren't being reflected immediately from cases 2 3.
>4) This may be
related - I am not using db.close() anywhere. I tried and I get TxClosedRolledBackException
(or something similar - can't remember now).
>
>I only have one
call to jdo.getDatabase() - should the db.close() match this? Why would I get
the exception I mentioned?
>
>Thanks in
advance.
>Regards,
>Brett
>~*~*~*~*~*~*~
>Brett Porter
>Web Developer, f2
Fairfax Interactive Network, Australia
>Ph: +61 2 8596
4437
>Email:
[EMAIL PROTECTED]
>This message was
posted using eunum
>To interact with
a real-time, threaded interface to this e-mail list, clickthe link below:
>[EMAIL PROTECTED]
>
-----------------------------------------------------------
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-dev