Export to GitHub

open-archetypes - issue #16

Integration tests cannot persist entities


Posted on Aug 9, 2010 by Swift Rhino

What steps will reproduce the problem? 1. Use a default generated project 2. Create a new test case with the following code:

public class DumboTest extends SeamTest { @Test public void testPersistUser() throws Exception { new ComponentTest() {

        @Override
        protected void testComponents() throws Exception {
            EntityManager entityManager = (EntityManager) Component.getInstance("entityManager");
            assert entityManager != null;

            User u = new User();
            User user = new User();
            user.setFirstName("Fady");
            user.setLastName("Matar");
            user.setUserName("fmatar");

            entityManager.persist(user);
        }
    }.run();
}

}

What is the expected output? What do you see instead? If you browser the db you should see a record in the db, yet nothing is there

Comment #1

Posted on Aug 9, 2010 by Happy Rhino

Strange. Looks like the transaction is not committed. How do seam-gen projects behave?

Comment #2

Posted on Aug 9, 2010 by Happy Rhino

(No comment was entered for this change.)

Comment #3

Posted on Aug 10, 2010 by Swift Rhino

Seam-gen works just fine, however it adds on a persistence.xml file which is currently embedded within the jar, probably we should set embedded-jboss to have more logging to see what's really going on.

Status: Accepted

Labels:
Type-Defect Priority-Medium Archetype-seam-ear-archetype