TypeOverridingInDialectTest.class
);
@Test
public void testOverriddenTypeInDialect() throws Exception {
final EntityManagerFactory emf = Persistence.createEntityManagerFactory( "jpajtastandalone" );
TransactionManager transactionManager = extractJBossTransactionManager( emf );
transactionManager.begin();
final EntityManager em = emf.createEntityManager();
try {
Poem poem = new Poem();
poem.setName( "L'albatros" );
poem.setPoemSocietyId( UUID.randomUUID() );
poem.setCreation( new Date() );
em.persist( poem );
transactionManager.commit();
assertThat( true ).as( "Custom type not used" ).isFalse();
}
catch ( RollbackException e ) {
//make this chaing more robust
assertThat( e.getCause().getCause().getMessage() ).isEqualTo( "Exploding type" );
}
finally {
try {
transactionManager.rollback();
}
catch ( Exception e ) {
//we try
}
em.close();
dropSchemaAndDatabase( emf );
emf.close();
}
}