EntityManagerFactory emf = Persistence.createEntityManagerFactory( "defaultpar", new HashMap() );
EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
ApplicationServer as = new ApplicationServer();
as.setName( "JBoss AS" );
Version v = new Version();
v.setMajor( 4 );
v.setMinor( 0 );
v.setMicro( 3 );
as.setVersion( v );
em.persist( as );
em.flush();
assertEquals( "Failure in default listeners", 1, IncrementListener.getIncrement() );
assertEquals( "Failuer in XML overriden listeners", 1, OtherIncrementListener.getIncrement() );