[jboss-user] [JBoss Seam] - DBUnit Data "Disappearing" During SeamTest
neilac333
do-not-reply at jboss.com
Mon Nov 5 18:20:39 EST 2007
NOTE: This may be more appropriate for a different forum, but it seemed best to start here.
I am using the DBUnit Ant task to do a clean insert of a seed file before running a SeamTest unit test. I have verified that DBUnit properly performs the insert I specify prior to the test. But for some odd reason, the data "disappears" during the test.
To make things clearer, here are my Ant task and a fragment of my test:
----------------------------------
The first 5 statements of the test (after variable declarations):
emf = Persistence.createEntityManagerFactory("jpaPersistenceUnit");
Assert.assertNotNull(emf, "entity manager factory null");
em = emf.createEntityManager();
Assert.assertNotNull(em, "entity manager null");
current = em.find(MyClass.class, new Long(1));
----------------------------------
DBUnit inserts a record with ID 1 as specified in the seed file. I verified this by running the DBUnit task without running the subsequent test. That last statement in the test, however, causes the test to fail because the entity manager is unable to find anything in the table with ID 1. And when I check the table, sure enough...the data that DBUnit inserted has vanished.
Why is this happening? Please let me know if you need more information.
Thanks for any insight.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4102008#4102008
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4102008
More information about the jboss-user
mailing list