Hi,
Now that we moved to Java 1.8, would you like to add a task so that we
manage the Session/Transaction automatically using a test utility like the
ones I added in the documentation tests:
doInHibernate( this::sessionFactory, session -> {
Person person = new Person();
person.id = 1L;
session.persist( person );
person.phones.add( "027-123-4567" );
person.phones.add( "028-234-9876" );
session.flush();
person.getPhones().remove( 0 );
} );
Or for JPA:
doInJPA( this::entityManagerFactory, entityManager -> {
Person person = new Person( 1L );
entityManager.persist( person );
person.addPhone( new Phone( 1L, "landline", "028-234-9876" ) );
person.addPhone( new Phone( 2L, "mobile", "072-122-9876" ) );
entityManager.flush();
person.removePhone( person.getPhones().get( 0 ) );
} );
1. The tests will be less verbose.
2. There are times when a test fails on MySQL and then the suite stops
because the connection is not closed properly and the DROP command hangs.
What do you think?
Vlad