HHH-11216 : Fixes required to backport
This commit is contained in:
parent
1c37385d2f
commit
6d7a14e4a2
|
@ -21,41 +21,36 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
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;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-11216")
|
@TestForIssue(jiraKey = "HHH-11216")
|
||||||
public class ElementCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
|
public class ElementCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
|
private InsertOrderingStatementInspector statementInspector = new InsertOrderingStatementInspector();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[] {Task.class};
|
return new Class[] {Task.class};
|
||||||
}
|
}
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addSettings(Map settings) {
|
protected void addSettings(Map settings) {
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
settings.put( Environment.ORDER_INSERTS, "true" );
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchOrdering() {
|
public void testBatchOrdering() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
Session session = openSession();
|
||||||
|
session.getTransaction().begin();
|
||||||
|
|
||||||
Task task = new Task();
|
Task task = new Task();
|
||||||
task.addCategory(Category.A);
|
task.addCategory(Category.A);
|
||||||
session.persist( task );
|
session.persist( task );
|
||||||
|
@ -63,13 +58,9 @@ public class ElementCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
Task task1 = new Task();
|
Task task1 = new Task();
|
||||||
task1.addCategory(Category.A);
|
task1.addCategory(Category.A);
|
||||||
session.persist( task1 );
|
session.persist( task1 );
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
session.getTransaction().commit();
|
||||||
public void releaseResources() {
|
session.close();
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
|
Loading…
Reference in New Issue