Skip to Main Content

Integration

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with Locking During Unit Tests

624666May 19 2009 — edited Jun 26 2009
I have an application that contains a number of JPA entities - many of which have references to others. These references form a hierarchy - I don't believe there are any circular references.

My unit tests will create an instance of entity A and then 3 instances of entity B - and all of those entities will be persisted. It will then pass the collection of B to the reference in A. A is then merged.

So far, so good.

My unit tests have a method that is run after each test method (although there is actually only one test method) which simply deletes all the test data created during the tests - using a Query object. This always hangs - apparently due to a database lock. Certainly, I'm getting errors with lock timeouts on the database. I've tried both SQL Server & MySQl with the same result.

I've spent a while googling around about locking problems - but can't find anything that might be related. I'm using Toplink 2.0.

Can anyone suggest a way forward?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 24 2009
Added on May 19 2009
19 comments
6,544 views