I look forward to "ever [having] time" :) But I am fine with adding support for it and using them in new tests. Remember too that Session, etal are AutoCloseable now too.
On Thu, Jun 16, 2016 at 10:25 AM Vlad Mihalcea <mihalcea.v...@gmail.com> wrote: > At first, we could add support for this method and start applying it for > new tests. > If we ever have time to migrate old tests, we should consider changing old > tests as well. > > Vlad > > On Thu, Jun 16, 2016 at 6:11 PM, Steve Ebersole <st...@hibernate.org> > wrote: > >> Not sure what you are asking specifically. You mean a task to change >> each and every test in the Hibernate testsuite? >> >> >> On Thu, Jun 16, 2016 at 9:18 AM Vlad Mihalcea <mihalcea.v...@gmail.com> >> wrote: >> >>> 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 >>> _______________________________________________ >>> hibernate-dev mailing list >>> hibernate-dev@lists.jboss.org >>> https://lists.jboss.org/mailman/listinfo/hibernate-dev >>> >> > _______________________________________________ hibernate-dev mailing list hibernate-dev@lists.jboss.org https://lists.jboss.org/mailman/listinfo/hibernate-dev