HHH-11634 : Fix test case to work in 5.1 branch

This commit is contained in:
Gail Badner 2018-01-25 20:52:04 -08:00
parent 4fb35c10eb
commit 06b105e100
1 changed files with 7 additions and 15 deletions

View File

@ -7,38 +7,26 @@
package org.hibernate.test.insertordering; package org.hibernate.test.insertordering;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import org.hibernate.Session;
import org.hibernate.cfg.Environment; import org.hibernate.cfg.Environment;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
/** /**
* @author Vlad Mihalcea * @author Vlad Mihalcea
*/ */
@ -70,7 +58,9 @@ public class InsertOrderingDuplicateTest
@Test @Test
public void testBatching() throws SQLException { public void testBatching() throws SQLException {
doInHibernate( this::sessionFactory, session -> { Session session = openSession();
session.getTransaction().begin();
{
SaleDocumentSummary saleDocumentsummary = new SaleDocumentSummary(); SaleDocumentSummary saleDocumentsummary = new SaleDocumentSummary();
session.persist(saleDocumentsummary); session.persist(saleDocumentsummary);
@ -90,7 +80,9 @@ public class InsertOrderingDuplicateTest
session.persist(correction); session.persist(correction);
saleDocument.setCorerctionSubject(correction); saleDocument.setCorerctionSubject(correction);
} ); }
session.getTransaction().commit();
session.close();
} }