3 Replies Latest reply on Apr 26, 2013 6:43 AM by Esteve Aviles

    @PersistenceTest vs @Transactional in Arquillian persistence extension

    Esteve Aviles Newbie



      I have a persistence test replicated, one uses @PersistenceTest class level annotation and the other user @Transactional annotation for each test.


      The class has three tests.


      With @Transactional annotation all tests end successfully. With @PersistenceTest, and without @Transactional, the segond transactional test always fails with a SQL exception.


      I have shared the project on github: https://github.com/esteveavi/sandbox


      You can run the test:


      With @Transactional annotation: --> Works OK

      mvn test -Dtest=CustomerTransactionalTest -Parq-jboss_as_managed_7.x


      With  @PersistenceTest annotation: --> Fails on test 3

      mvn test -Dtest=CustomerPersistenceTest -Parq-jboss_as_managed_7.x



      Thanks in advance.