tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Saint Croix" <>
Subject Re: Nuking tables on tearDown() for CRUD tests
Date Tue, 08 Jan 2008 23:08:13 GMT
After working with devs on both the OpenEJB and the OpenJPA teams, I think
that for anything other than trivial persistence units and entity relations,
it is probably necessary to manually find a list of all of the entities of a
given type, iterate over that list, and use the entitymanager.remove()
method to clean out the entities in the datastore between unit tests.
Although this method is extremely slow and will be a big hit to
productivity, I cannot get a succession of "DELETE FROM table" queries to
reliably remove objects without crashing because of entity relations and
foreign keys, and have not yet had the former method crash on me.

The "DELETE FROM table" mechanism seems to wreak havoc on the cascading
rules and cause problems for itself when done in succession to multiple
tables--I don't know enough about the guts of the query execution mechanism
to say why, and that's alright.  If we need to build an example application
for either project to test this behavior at a later time, I'll be able to
provide a sufficiently complex persistence unit to really stress test

In the meantime, I really am itching to get back to actual development, so
I'm going to revert and move forward using the other method for the time
being. Thanks to Dain, Panaki, Jacek, Adam, and Patrick.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message