Merge remote-tracking branch 'upstream/master' into wip/6.0
This commit is contained in:
commit
93cd8aaf4e
|
@ -1102,7 +1102,7 @@ public class ActionQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if the this {@link BatchIdentifier} has a parent or grand parent
|
* Check if this {@link BatchIdentifier} has a parent or grand parent
|
||||||
* matching the given {@link BatchIdentifier} reference.
|
* matching the given {@link BatchIdentifier} reference.
|
||||||
*
|
*
|
||||||
* @param batchIdentifier {@link BatchIdentifier} reference
|
* @param batchIdentifier {@link BatchIdentifier} reference
|
||||||
|
@ -1269,8 +1269,10 @@ public class ActionQueue {
|
||||||
for ( int i = 0; i < propertyValues.length; i++ ) {
|
for ( int i = 0; i < propertyValues.length; i++ ) {
|
||||||
Object value = propertyValues[i];
|
Object value = propertyValues[i];
|
||||||
Type type = propertyTypes[i];
|
Type type = propertyTypes[i];
|
||||||
|
if ( value != null ) {
|
||||||
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value );
|
addParentChildEntityNameByPropertyAndValue( action, batchIdentifier, type, value );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( identifierType.isComponentType() ) {
|
if ( identifierType.isComponentType() ) {
|
||||||
CompositeType compositeType = (CompositeType) identifierType;
|
CompositeType compositeType = (CompositeType) identifierType;
|
||||||
|
|
|
@ -9,6 +9,8 @@ import javax.persistence.TypedQuery;
|
||||||
|
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||||
|
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
@ -20,6 +22,7 @@ import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
||||||
* @author Nathan Xu
|
* @author Nathan Xu
|
||||||
*/
|
*/
|
||||||
@TestForIssue( jiraKey = "HHH-14231" )
|
@TestForIssue( jiraKey = "HHH-14231" )
|
||||||
|
@RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class )
|
||||||
public class ScrollableResultsObjectArrayCastingTest extends BaseEntityManagerFunctionalTestCase {
|
public class ScrollableResultsObjectArrayCastingTest extends BaseEntityManagerFunctionalTestCase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,7 +34,7 @@ public class ScrollableResultsObjectArrayCastingTest extends BaseEntityManagerFu
|
||||||
public void SetUp() {
|
public void SetUp() {
|
||||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
doInJPA( this::entityManagerFactory, entityManager -> {
|
||||||
Product product = new Product();
|
Product product = new Product();
|
||||||
product.binaryValue = "".getBytes();
|
product.binaryValue = new byte[] { 1, 2, 3 };
|
||||||
entityManager.persist( product );
|
entityManager.persist( product );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.hibernate.cfg.AvailableSettings;
|
||||||
|
import org.hibernate.cfg.Environment;
|
||||||
|
|
||||||
|
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
||||||
|
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.mockito.Mockito.times;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Nathan Xu
|
||||||
|
*/
|
||||||
|
abstract class BaseInsertOrderingTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
|
|
||||||
|
static class Batch {
|
||||||
|
String sql;
|
||||||
|
int size;
|
||||||
|
|
||||||
|
Batch(String sql, int size) {
|
||||||
|
this.sql = sql;
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
Batch(String sql) {
|
||||||
|
this( sql, 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void addSettings(Map settings) {
|
||||||
|
settings.put( Environment.ORDER_INSERTS, "true" );
|
||||||
|
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
||||||
|
settings.put( AvailableSettings.CONNECTION_PROVIDER, connectionProvider );
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void releaseResources() {
|
||||||
|
super.releaseResources();
|
||||||
|
connectionProvider.stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void verifyContainsBatches(Batch... expectedBatches) {
|
||||||
|
for ( Batch expectedBatch : expectedBatches ) {
|
||||||
|
PreparedStatement preparedStatement = connectionProvider.getPreparedStatement( expectedBatch.sql );
|
||||||
|
try {
|
||||||
|
verify( preparedStatement, times( expectedBatch.size ) ).addBatch();
|
||||||
|
verify( preparedStatement, times( 1 ) ).executeBatch();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new RuntimeException( e );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void verifyPreparedStatementCount(int expectedBatchCount) {
|
||||||
|
final int realBatchCount = connectionProvider.getPreparedSQLStatements().size();
|
||||||
|
assertEquals( String.format( "expected %d batch%s; but found %d batch%s", expectedBatchCount, (expectedBatchCount == 1 ? "" : "es"), realBatchCount, (realBatchCount == 1 ? "" : "es" ) ),
|
||||||
|
expectedBatchCount, realBatchCount );
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearBatches() {
|
||||||
|
connectionProvider.clear();
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,33 +4,32 @@
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
||||||
*/
|
*/
|
||||||
package org.hibernate.engine.spi;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
|
||||||
import org.hibernate.testing.jta.TestingJtaBootstrap;
|
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.JoinColumn;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @author gajendra.jatav(raaz2.gajendra@gmail.com)
|
* @author gajendra.jatav(raaz2.gajendra@gmail.com)
|
||||||
*/
|
*/
|
||||||
public class BatchSortingTest extends BaseNonConfigCoreFunctionalTestCase {
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
|
public class BatchSortingTest extends BaseInsertOrderingTest {
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.ORDER_UPDATES, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "5" );
|
|
||||||
TestingJtaBootstrap.prepare( settings );
|
|
||||||
}
|
|
||||||
|
|
||||||
protected Class<?>[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class<?>[]{
|
return new Class<?>[]{
|
||||||
|
@ -59,7 +58,10 @@ public class BatchSortingTest extends BaseNonConfigCoreFunctionalTestCase {
|
||||||
country.setDistricts( geoDistricts );
|
country.setDistricts( geoDistricts );
|
||||||
session.persist( geoDistrict );
|
session.persist( geoDistrict );
|
||||||
session.persist( nation );
|
session.persist( nation );
|
||||||
|
clearBatches();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
verifyPreparedStatementCount( 4 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "GeoCountry")
|
@Entity(name = "GeoCountry")
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CollectionTable;
|
import javax.persistence.CollectionTable;
|
||||||
import javax.persistence.ElementCollection;
|
import javax.persistence.ElementCollection;
|
||||||
|
@ -21,10 +20,9 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
@ -33,19 +31,14 @@ 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 {
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
|
public class ElementCollectionTest extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[] {Task.class};
|
return new Class[] {Task.class};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchOrdering() {
|
public void testBatchOrdering() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
|
@ -56,7 +49,14 @@ 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 );
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into TASK (id) values (?)", 2 ),
|
||||||
|
new Batch( "insert into TASK_CATEGORY (TASK_ID, categories) values (?, ?)", 2 )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
|
|
@ -7,9 +7,7 @@
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -20,22 +18,19 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-11634")
|
@TestForIssue(jiraKey = "HHH-11634")
|
||||||
public class InsertOrderingDuplicateTest
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
public class InsertOrderingDuplicateTest extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
|
@ -47,19 +42,8 @@ public class InsertOrderingDuplicateTest
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
|
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
SaleDocumentItem saleDocumentItem = new SaleDocumentItem();
|
SaleDocumentItem saleDocumentItem = new SaleDocumentItem();
|
||||||
|
@ -82,9 +66,17 @@ public class InsertOrderingDuplicateTest
|
||||||
session.persist(correction);
|
session.persist(correction);
|
||||||
|
|
||||||
saleDocument.setCorerctionsubject( correction);
|
saleDocument.setCorerctionsubject( correction);
|
||||||
} );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
|
} );
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into SaleDocumentSummary (sale_number, totalPrice, id) values (?, ?, ?)" ),
|
||||||
|
new Batch( "insert into Product (description, name, price, quantity, id) values (?, ?, ?, ?, ?)" ),
|
||||||
|
new Batch( "insert into SaleDocument (ID_SALE_DOCUMENT_CORRECTION, sale_number, totalPrice, id) values (?, ?, ?, ?)", 2 ),
|
||||||
|
new Batch( "insert into SaleDocumentItem (lp, product_id, quantity, ID_SALE_DOCUMENT, ID_SALE_DOCUMENT_SUMAMRY, id) values (?, ?, ?, ?, ?, ?)" )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@Entity(name = "Product")
|
@Entity(name = "Product")
|
||||||
public static class Product {
|
public static class Product {
|
||||||
|
|
|
@ -9,7 +9,6 @@ package org.hibernate.test.insertordering;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -19,10 +18,9 @@ import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
@ -31,18 +29,14 @@ import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
* @author Andrea Boriero
|
* @author Andrea Boriero
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-12380")
|
@TestForIssue(jiraKey = "HHH-12380")
|
||||||
public class InsertOrderingHasParentTest extends BaseNonConfigCoreFunctionalTestCase {
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
|
public class InsertOrderingHasParentTest extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[] { Author.class, Book.class, Comment.class };
|
return new Class[] { Author.class, Book.class, Comment.class };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInsert() {
|
public void testInsert() {
|
||||||
|
|
||||||
|
@ -55,8 +49,16 @@ public class InsertOrderingHasParentTest extends BaseNonConfigCoreFunctionalTest
|
||||||
author.setBook( book );
|
author.setBook( book );
|
||||||
|
|
||||||
session.persist( author );
|
session.persist( author );
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into book_comment (book_comment, id) values (?, ?)", 2 ),
|
||||||
|
new Batch( "insert into Book (comment_id, id) values (?, ?)" ),
|
||||||
|
new Batch( "insert into Author (book_id, id) values (?, ?)" ),
|
||||||
|
new Batch( "insert into Book_book_comment (Book_id, comments_id) values (?, ?)" )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Author")
|
@Entity(name = "Author")
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Normunds Gavars
|
||||||
|
* @author Nathan Xu
|
||||||
|
*/
|
||||||
|
@TestForIssue( jiraKey = "HHH-14227" )
|
||||||
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
|
public class InsertOrderingReferenceDifferentSubclassTest extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
|
return new Class<?>[] {
|
||||||
|
SubclassA.class,
|
||||||
|
SubclassB.class
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReferenceDifferentSubclass() {
|
||||||
|
doInHibernate(this::sessionFactory, session -> {
|
||||||
|
SubclassA subclassA1 = new SubclassA();
|
||||||
|
SubclassB subclassB1 = new SubclassB();
|
||||||
|
|
||||||
|
SubclassA subclassA2 = new SubclassA();
|
||||||
|
SubclassB subclassB2 = new SubclassB();
|
||||||
|
|
||||||
|
subclassA1.referenceB = subclassB2;
|
||||||
|
subclassB2.referenceA = subclassA2;
|
||||||
|
|
||||||
|
subclassA2.referenceB = subclassB1;
|
||||||
|
|
||||||
|
session.save( subclassA1 );
|
||||||
|
session.save( subclassA2 );
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
|
});
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into SubclassB (referenceA_id, id) values (?, ?)", 2 ),
|
||||||
|
new Batch( "insert into SubclassA (referenceB_id, id) values (?, ?)", 2 )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@MappedSuperclass
|
||||||
|
static class BaseClass {
|
||||||
|
|
||||||
|
@Id @GeneratedValue
|
||||||
|
Long id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity(name = "SubclassA")
|
||||||
|
static class SubclassA extends BaseClass {
|
||||||
|
|
||||||
|
@OneToOne(cascade = CascadeType.ALL)
|
||||||
|
SubclassB referenceB;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity(name = "SubclassB")
|
||||||
|
static class SubclassB extends BaseClass {
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
SubclassA referenceA;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,17 +19,12 @@ import javax.persistence.OneToOne;
|
||||||
|
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
import org.hibernate.annotations.GenericGenerator;
|
|
||||||
import org.hibernate.annotations.Parameter;
|
|
||||||
import org.hibernate.cfg.Environment;
|
import org.hibernate.cfg.Environment;
|
||||||
import org.hibernate.id.enhanced.SequenceStyleGenerator;
|
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import javax.persistence.CascadeType;
|
||||||
|
import javax.persistence.DiscriminatorColumn;
|
||||||
|
import javax.persistence.DiscriminatorValue;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.FetchType;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.Inheritance;
|
||||||
|
import javax.persistence.InheritanceType;
|
||||||
|
import javax.persistence.ManyToOne;
|
||||||
|
import javax.persistence.MappedSuperclass;
|
||||||
|
import javax.persistence.OneToMany;
|
||||||
|
|
||||||
|
import org.hibernate.annotations.Cache;
|
||||||
|
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||||
|
import org.hibernate.annotations.Fetch;
|
||||||
|
import org.hibernate.annotations.FetchMode;
|
||||||
|
import org.hibernate.annotations.SortNatural;
|
||||||
|
import org.hibernate.annotations.Where;
|
||||||
|
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Normunds Gavars
|
||||||
|
* @author Nathan Xu
|
||||||
|
*/
|
||||||
|
@TestForIssue( jiraKey = "HHH-14227" )
|
||||||
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
|
public class InsertOrderingSelfReferenceTest extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
|
return new Class<?>[] {
|
||||||
|
Parameter.class,
|
||||||
|
InputParameter.class,
|
||||||
|
OutputParameter.class,
|
||||||
|
Placeholder.class,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testReferenceItself() {
|
||||||
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
|
Placeholder placeholder = new Placeholder();
|
||||||
|
session.save( placeholder );
|
||||||
|
|
||||||
|
OutputParameter outputParameter1 = new OutputParameter();
|
||||||
|
|
||||||
|
OutputParameter childOutputParameter = new OutputParameter();
|
||||||
|
outputParameter1.children.add( childOutputParameter );
|
||||||
|
childOutputParameter.parent = outputParameter1;
|
||||||
|
|
||||||
|
session.save( outputParameter1 );
|
||||||
|
|
||||||
|
Placeholder placeholder2 = new Placeholder();
|
||||||
|
session.save( placeholder2 );
|
||||||
|
|
||||||
|
InputParameter inputParameter = new InputParameter();
|
||||||
|
session.save( inputParameter );
|
||||||
|
|
||||||
|
OutputParameter outputParameter2 = new OutputParameter();
|
||||||
|
session.save( outputParameter2 );
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
|
} );
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into Placeholder (id) values (?)", 2 ),
|
||||||
|
new Batch( "insert into Parameter (parent_id, TYPE, id) values (?, 'INPUT', ?)" ),
|
||||||
|
new Batch( "insert into Parameter (parent_id, TYPE, id) values (?, 'OUTPUT', ?)", 3 )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@MappedSuperclass
|
||||||
|
static class AbstractEntity {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
@GeneratedValue
|
||||||
|
Long id;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity(name = "Placeholder")
|
||||||
|
static class Placeholder extends AbstractEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity(name = "Parameter")
|
||||||
|
@DiscriminatorColumn(name = "TYPE")
|
||||||
|
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||||
|
static abstract class Parameter extends AbstractEntity {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity(name = "InputParameter")
|
||||||
|
@DiscriminatorValue("INPUT")
|
||||||
|
static class InputParameter extends Parameter {
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
InputParameter parent;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "parent")
|
||||||
|
@SortNatural
|
||||||
|
@Where(clause = "TYPE = 'INPUT'")
|
||||||
|
@Fetch(FetchMode.SUBSELECT)
|
||||||
|
List<InputParameter> children = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Entity(name = "OutputParameter")
|
||||||
|
@DiscriminatorValue("OUTPUT")
|
||||||
|
static class OutputParameter extends Parameter {
|
||||||
|
|
||||||
|
@ManyToOne(fetch = FetchType.LAZY)
|
||||||
|
OutputParameter parent;
|
||||||
|
|
||||||
|
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true, mappedBy = "parent")
|
||||||
|
@SortNatural
|
||||||
|
@Where(clause = "TYPE = 'OUTPUT'")
|
||||||
|
@Fetch(FetchMode.SUBSELECT)
|
||||||
|
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
|
||||||
|
List<OutputParameter> children = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,6 @@ 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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
|
@ -6,11 +6,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -20,53 +17,27 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToMany;
|
import javax.persistence.ManyToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.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
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithBidirectionalManyToMany
|
public class InsertOrderingWithBidirectionalManyToMany extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class };
|
return new Class[] { Address.class, Person.class };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Person father = new Person();
|
Person father = new Person();
|
||||||
Person mother = new Person();
|
Person mother = new Person();
|
||||||
|
@ -87,18 +58,14 @@ public class InsertOrderingWithBidirectionalManyToMany
|
||||||
session.persist( home );
|
session.persist( home );
|
||||||
session.persist( office );
|
session.persist( office );
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
assertEquals( 3, connectionProvider.getPreparedStatements().size() );
|
verifyContainsBatches(
|
||||||
PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
new Batch( "insert into Address (ID) values (?)", 2 ),
|
||||||
"insert into Address (ID) values (?)" );
|
new Batch( "insert into Person (ID) values (?)", 4 ),
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
new Batch( "insert into Person_Address (persons_ID, addresses_ID) values (?, ?)", 6 )
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
);
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
|
||||||
"insert into Person (ID) values (?)" );
|
|
||||||
verify( personPreparedStatement, times( 4 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Address")
|
@Entity(name = "Address")
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -19,52 +16,27 @@ import javax.persistence.MapsId;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithBidirectionalMapsIdOneToOne
|
public class InsertOrderingWithBidirectionalMapsIdOneToOne extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class };
|
return new Class<?>[] { Address.class, Person.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Person worker = new Person();
|
Person worker = new Person();
|
||||||
Person homestay = new Person();
|
Person homestay = new Person();
|
||||||
|
@ -79,17 +51,13 @@ public class InsertOrderingWithBidirectionalMapsIdOneToOne
|
||||||
session.persist( home );
|
session.persist( home );
|
||||||
session.persist( office );
|
session.persist( office );
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
verifyContainsBatches(
|
||||||
"insert into Address (ID) values (?)" );
|
new Batch( "insert into Address (ID) values (?)", 2 ),
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
new Batch( "insert into Person (address_ID) values (?)", 2 )
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
);
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
|
||||||
"insert into Person (address_ID) values (?)" );
|
|
||||||
verify( personPreparedStatement, times( 2 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Address")
|
@Entity(name = "Address")
|
||||||
|
|
|
@ -6,11 +6,8 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -21,52 +18,27 @@ import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithBidirectionalOneToMany
|
public class InsertOrderingWithBidirectionalOneToMany extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class };
|
return new Class<?>[] { Address.class, Person.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Person father = new Person();
|
Person father = new Person();
|
||||||
Person mother = new Person();
|
Person mother = new Person();
|
||||||
|
@ -87,17 +59,13 @@ public class InsertOrderingWithBidirectionalOneToMany
|
||||||
session.persist( home );
|
session.persist( home );
|
||||||
session.persist( office );
|
session.persist( office );
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
verifyContainsBatches(
|
||||||
"insert into Address (ID) values (?)" );
|
new Batch( "insert into Address (ID) values (?)", 2 ),
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
new Batch( "insert into Person (address_ID, ID) values (?, ?)", 4 )
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
);
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
|
||||||
"insert into Person (address_ID, ID) values (?, ?)" );
|
|
||||||
verify( personPreparedStatement, times( 4 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Address")
|
@Entity(name = "Address")
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
|
@ -17,19 +16,18 @@ import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
|
import org.hibernate.testing.DialectChecks;
|
||||||
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static javax.persistence.CascadeType.PERSIST;
|
import static javax.persistence.CascadeType.PERSIST;
|
||||||
import static javax.persistence.GenerationType.SEQUENCE;
|
import static javax.persistence.GenerationType.SEQUENCE;
|
||||||
import static org.hibernate.cfg.AvailableSettings.ORDER_INSERTS;
|
|
||||||
import static org.hibernate.cfg.AvailableSettings.STATEMENT_BATCH_SIZE;
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
@TestForIssue(jiraKey = "HHH-12074")
|
@TestForIssue(jiraKey = "HHH-12074")
|
||||||
public class InsertOrderingWithBidirectionalOneToManyFlushProblem
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
public class InsertOrderingWithBidirectionalOneToManyFlushProblem extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchingWithFlush() {
|
public void testBatchingWithFlush() {
|
||||||
|
@ -40,12 +38,16 @@ public class InsertOrderingWithBidirectionalOneToManyFlushProblem
|
||||||
|
|
||||||
session.persist( top1 );
|
session.persist( top1 );
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
|
|
||||||
// InsertActionSorter#sort is invoked during this flush.
|
// InsertActionSorter#sort is invoked during this flush.
|
||||||
//
|
//
|
||||||
// input: [top1]
|
// input: [top1]
|
||||||
// output: [top1]
|
// output: [top1]
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
|
verifyContainsBatches( new Batch( "insert into TopEntity (id) values (?)" ) );
|
||||||
|
|
||||||
MiddleEntity middle1 = new MiddleEntity();
|
MiddleEntity middle1 = new MiddleEntity();
|
||||||
|
|
||||||
middle1.addBottom( new BottomEntity() );
|
middle1.addBottom( new BottomEntity() );
|
||||||
|
@ -71,8 +73,16 @@ public class InsertOrderingWithBidirectionalOneToManyFlushProblem
|
||||||
// when the attempt to insert middle2 before top2 is made.
|
// when the attempt to insert middle2 before top2 is made.
|
||||||
//
|
//
|
||||||
// correct ordering is: [top2,middle1,middle2,bottom1,bottom2]
|
// correct ordering is: [top2,middle1,middle2,bottom1,bottom2]
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into TopEntity (id) values (?)" ),
|
||||||
|
new Batch( "insert into MiddleEntity (top_id, id) values (?, ?)", 2 ),
|
||||||
|
new Batch( "insert into BottomEntity (middle_id, id) values (?, ?)", 2 )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -89,8 +99,11 @@ public class InsertOrderingWithBidirectionalOneToManyFlushProblem
|
||||||
//
|
//
|
||||||
// input: [top1]
|
// input: [top1]
|
||||||
// output: [top1]
|
// output: [top1]
|
||||||
|
clearBatches();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
|
verifyContainsBatches( new Batch( "insert into TopEntity (id) values (?)" ) );
|
||||||
|
|
||||||
MiddleEntity middle1 = new MiddleEntity();
|
MiddleEntity middle1 = new MiddleEntity();
|
||||||
|
|
||||||
middle1.addBottom( new BottomEntity() );
|
middle1.addBottom( new BottomEntity() );
|
||||||
|
@ -120,19 +133,21 @@ public class InsertOrderingWithBidirectionalOneToManyFlushProblem
|
||||||
// when the attempt to insert middle2 before top2 is made.
|
// when the attempt to insert middle2 before top2 is made.
|
||||||
//
|
//
|
||||||
// correct ordering is: [top2,middle1,middle2,bottom1,bottom2]
|
// correct ordering is: [top2,middle1,middle2,bottom1,bottom2]
|
||||||
|
clearBatches();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into TopEntity (id) values (?)", 2 ),
|
||||||
|
new Batch( "insert into MiddleEntity (top_id, id) values (?, ?)", 2 ),
|
||||||
|
new Batch( "insert into BottomEntity (middle_id, id) values (?, ?)", 2 ),
|
||||||
|
new Batch( "insert into BottomEntity2 (middle_id, id) values (?, ?)", 2 )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addSettings(Map settings) {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
settings.put( ORDER_INSERTS, "true" );
|
return new Class<?>[] { TopEntity.class, MiddleEntity.class, BottomEntity.class, BottomEntity2.class };
|
||||||
settings.put( STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class[] getAnnotatedClasses() {
|
|
||||||
return new Class[] { TopEntity.class, MiddleEntity.class, BottomEntity.class, BottomEntity2.class };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "BottomEntity")
|
@Entity(name = "BottomEntity")
|
||||||
|
|
|
@ -6,56 +6,36 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
import javax.persistence.CascadeType;
|
||||||
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.GeneratedValue;
|
||||||
|
import javax.persistence.GenerationType;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import javax.persistence.OneToOne;
|
||||||
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithBidirectionalOneToOne
|
public class InsertOrderingWithBidirectionalOneToOne extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class };
|
return new Class<?>[] { Address.class, Person.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Person worker = new Person();
|
Person worker = new Person();
|
||||||
Person homestay = new Person();
|
Person homestay = new Person();
|
||||||
|
@ -70,17 +50,13 @@ public class InsertOrderingWithBidirectionalOneToOne
|
||||||
session.persist( home );
|
session.persist( home );
|
||||||
session.persist( office );
|
session.persist( office );
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
verifyContainsBatches(
|
||||||
"insert into Address (ID) values (?)" );
|
new Batch( "insert into Address (ID) values (?)", 2 ),
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
new Batch( "insert into Person (address_ID, ID) values (?, ?)", 2 )
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
);
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
|
||||||
"insert into Person (address_ID, ID) values (?, ?)" );
|
|
||||||
verify( personPreparedStatement, times( 2 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Address")
|
@Entity(name = "Address")
|
||||||
|
|
|
@ -6,27 +6,25 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import java.util.ArrayList;
|
||||||
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
|
import java.util.List;
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
import javax.persistence.OneToMany;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import static org.hibernate.cfg.AvailableSettings.ORDER_INSERTS;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import static org.hibernate.cfg.AvailableSettings.STATEMENT_BATCH_SIZE;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
@TestForIssue(jiraKey = "HHH-12105")
|
@TestForIssue(jiraKey = "HHH-12105")
|
||||||
public class InsertOrderingWithBidirectionalOneToOneFlushProblem
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
public class InsertOrderingWithBidirectionalOneToOneFlushProblem extends BaseInsertOrderingTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInsertSortingWithFlushPersistLeftBeforeRight() {
|
public void testInsertSortingWithFlushPersistLeftBeforeRight() {
|
||||||
|
@ -36,8 +34,11 @@ public class InsertOrderingWithBidirectionalOneToOneFlushProblem
|
||||||
TopEntity top1 = new TopEntity();
|
TopEntity top1 = new TopEntity();
|
||||||
|
|
||||||
session.persist(top1);
|
session.persist(top1);
|
||||||
|
clearBatches();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
|
verifyContainsBatches( new Batch( "insert into TopEntity (id) values (?)" ) );
|
||||||
|
|
||||||
LeftEntity left = new LeftEntity();
|
LeftEntity left = new LeftEntity();
|
||||||
RightEntity right = new RightEntity();
|
RightEntity right = new RightEntity();
|
||||||
TopEntity top2 = new TopEntity();
|
TopEntity top2 = new TopEntity();
|
||||||
|
@ -54,8 +55,16 @@ public class InsertOrderingWithBidirectionalOneToOneFlushProblem
|
||||||
session.persist(left);
|
session.persist(left);
|
||||||
session.persist(right);
|
session.persist(right);
|
||||||
session.persist(top2);
|
session.persist(top2);
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into TopEntity (id) values (?)" ),
|
||||||
|
new Batch( "insert into LeftEntity (top_id, id) values (?, ?)" ),
|
||||||
|
new Batch( "insert into RightEntity (left_id, top_id, id) values (?, ?, ?)" )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -66,8 +75,11 @@ public class InsertOrderingWithBidirectionalOneToOneFlushProblem
|
||||||
TopEntity top1 = new TopEntity();
|
TopEntity top1 = new TopEntity();
|
||||||
|
|
||||||
session.persist(top1);
|
session.persist(top1);
|
||||||
|
clearBatches();
|
||||||
session.flush();
|
session.flush();
|
||||||
|
|
||||||
|
verifyContainsBatches( new Batch( "insert into TopEntity (id) values (?)" ) );
|
||||||
|
|
||||||
LeftEntity left = new LeftEntity();
|
LeftEntity left = new LeftEntity();
|
||||||
RightEntity right = new RightEntity();
|
RightEntity right = new RightEntity();
|
||||||
TopEntity top2 = new TopEntity();
|
TopEntity top2 = new TopEntity();
|
||||||
|
@ -84,19 +96,21 @@ public class InsertOrderingWithBidirectionalOneToOneFlushProblem
|
||||||
session.persist(right);
|
session.persist(right);
|
||||||
session.persist(left);
|
session.persist(left);
|
||||||
session.persist(top2);
|
session.persist(top2);
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into TopEntity (id) values (?)" ),
|
||||||
|
new Batch( "insert into LeftEntity (top_id, id) values (?, ?)" ),
|
||||||
|
new Batch( "insert into RightEntity (left_id, top_id, id) values (?, ?, ?)" )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void addSettings(Map settings) {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
settings.put( ORDER_INSERTS, "true" );
|
return new Class<?>[]{
|
||||||
settings.put( STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected Class[] getAnnotatedClasses() {
|
|
||||||
return new Class[]{
|
|
||||||
LeftEntity.class, RightEntity.class, TopEntity.class,
|
LeftEntity.class, RightEntity.class, TopEntity.class,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
import javax.persistence.AccessType;
|
import javax.persistence.AccessType;
|
||||||
|
@ -28,47 +27,24 @@ import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.BatchSize;
|
import org.hibernate.annotations.BatchSize;
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithJoinedTableInheritance
|
public class InsertOrderingWithJoinedTableInheritance extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( false, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class, SpecialPerson.class };
|
return new Class<?>[] { Address.class, Person.class, SpecialPerson.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -98,10 +74,10 @@ public class InsertOrderingWithJoinedTableInheritance
|
||||||
specialPerson.addAddress( new Address() );
|
specialPerson.addAddress( new Address() );
|
||||||
session.persist( specialPerson );
|
session.persist( specialPerson );
|
||||||
}
|
}
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
assertEquals( 26, connectionProvider.getPreparedStatements().size() );
|
verifyPreparedStatementCount( 26 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,7 +8,6 @@ package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
|
@ -27,31 +26,24 @@ import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.BatchSize;
|
import org.hibernate.annotations.BatchSize;
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithJoinedTableMultiLevelInheritance
|
public class InsertOrderingWithJoinedTableMultiLevelInheritance extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( false, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] {
|
return new Class<?>[] {
|
||||||
Address.class,
|
Address.class,
|
||||||
Person.class,
|
Person.class,
|
||||||
SpecialPerson.class,
|
SpecialPerson.class,
|
||||||
|
@ -61,22 +53,6 @@ public class InsertOrderingWithJoinedTableMultiLevelInheritance
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchingAmongstSubClasses() {
|
public void testBatchingAmongstSubClasses() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
|
@ -99,10 +75,10 @@ public class InsertOrderingWithJoinedTableMultiLevelInheritance
|
||||||
specialPerson.addAddress( new Address() );
|
specialPerson.addAddress( new Address() );
|
||||||
session.persist( specialPerson );
|
session.persist( specialPerson );
|
||||||
}
|
}
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
assertEquals( 17, connectionProvider.getPreparedStatements().size() );
|
verifyPreparedStatementCount( 17 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,67 +6,35 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
import javax.persistence.GenerationType;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.OneToMany;
|
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithManyToOne
|
public class InsertOrderingWithManyToOne extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class };
|
return new Class<?>[] { Address.class, Person.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Person father = new Person();
|
Person father = new Person();
|
||||||
Person mother = new Person();
|
Person mother = new Person();
|
||||||
|
@ -89,17 +57,13 @@ public class InsertOrderingWithManyToOne
|
||||||
session.persist( son );
|
session.persist( son );
|
||||||
session.persist( daughter );
|
session.persist( daughter );
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
verifyContainsBatches(
|
||||||
"insert into Address (ID) values (?)" );
|
new Batch( "insert into Address (ID) values (?)", 2 ),
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
new Batch( "insert into Person (address_ID, ID) values (?, ?)", 4 )
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
);
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
|
||||||
"insert into Person (address_ID, ID) values (?, ?)" );
|
|
||||||
verify( personPreparedStatement, times( 4 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Address")
|
@Entity(name = "Address")
|
||||||
|
|
|
@ -6,72 +6,36 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
|
||||||
import javax.persistence.Column;
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.GeneratedValue;
|
import javax.persistence.GeneratedValue;
|
||||||
import javax.persistence.GenerationType;
|
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
||||||
import javax.persistence.ManyToMany;
|
|
||||||
import javax.persistence.ManyToOne;
|
import javax.persistence.ManyToOne;
|
||||||
import javax.persistence.SequenceGenerator;
|
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.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
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-11996")
|
@TestForIssue(jiraKey = "HHH-11996")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithMultipleManyToOne
|
public class InsertOrderingWithMultipleManyToOne extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( false, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] {
|
return new Class<?>[] {
|
||||||
Parent.class,
|
Parent.class,
|
||||||
ChildA.class,
|
ChildA.class,
|
||||||
ChildB.class,
|
ChildB.class,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Parent parent = new Parent();
|
Parent parent = new Parent();
|
||||||
session.persist(parent);
|
session.persist(parent);
|
||||||
|
@ -84,18 +48,16 @@ public class InsertOrderingWithMultipleManyToOne
|
||||||
childB.setParent(parent);
|
childB.setParent(parent);
|
||||||
session.persist(childB);
|
session.persist(childB);
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
assertEquals( 3, connectionProvider.getPreparedStatements().size() );
|
verifyPreparedStatementCount( 3 );
|
||||||
/*PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
/*
|
||||||
"insert into Address (ID) values (?)" );
|
Map<String, Integer> expectedBatching = new HashMap<>();
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
expectedBatching.put( "insert into Address (ID) values (?)", 2 );
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
expectedBatching.put( "insert into Person (ID) values (?)", 4 );
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
verifyBatching( expectedBatching );
|
||||||
"insert into Person (ID) values (?)" );
|
*/
|
||||||
verify( personPreparedStatement, times( 4 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Parent")
|
@Entity(name = "Parent")
|
||||||
|
|
|
@ -8,8 +8,6 @@ package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.DiscriminatorColumn;
|
import javax.persistence.DiscriminatorColumn;
|
||||||
|
@ -30,25 +28,19 @@ import javax.persistence.SecondaryTable;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Chris Cranford
|
* @author Chris Cranford
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-11714")
|
@TestForIssue(jiraKey = "HHH-11714")
|
||||||
public class InsertOrderingWithSecondaryTable extends BaseEntityManagerFunctionalTestCase {
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
@Override
|
public class InsertOrderingWithSecondaryTable extends BaseInsertOrderingTest {
|
||||||
protected void addConfigOptions(Map options) {
|
|
||||||
super.addConfigOptions( options );
|
|
||||||
options.put( AvailableSettings.ORDER_INSERTS, Boolean.TRUE );
|
|
||||||
options.put( AvailableSettings.ORDER_UPDATES, Boolean.TRUE );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class<?>[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
|
@ -63,7 +55,7 @@ public class InsertOrderingWithSecondaryTable extends BaseEntityManagerFunctiona
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testInheritanceWithSecondaryTable() {
|
public void testInheritanceWithSecondaryTable() {
|
||||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
final TopLevelEntity top = new TopLevelEntity();
|
final TopLevelEntity top = new TopLevelEntity();
|
||||||
|
|
||||||
final GeographicArea area1 = new GeographicArea();
|
final GeographicArea area1 = new GeographicArea();
|
||||||
|
@ -79,9 +71,18 @@ public class InsertOrderingWithSecondaryTable extends BaseEntityManagerFunctiona
|
||||||
area2.setShape( circle );
|
area2.setShape( circle );
|
||||||
top.getGeographicAreas().add( area2 );
|
top.getGeographicAreas().add( area2 );
|
||||||
|
|
||||||
entityManager.persist( top );
|
session.save( top );
|
||||||
entityManager.flush();
|
|
||||||
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
|
verifyContainsBatches(
|
||||||
|
new Batch( "insert into TOP_LEVEL (id) values (?)" ),
|
||||||
|
new Batch( "insert into SHAPE (SHAPE_TYPE, SHAPE_ID) values ('POLYGON', ?)" ),
|
||||||
|
new Batch( "insert into SHAPE (SHAPE_TYPE, SHAPE_ID) values ('CIRCLE', ?)" ),
|
||||||
|
new Batch( "insert into SHAPE_CIRCLE (centre, SHAPE_ID) values (?, ?)" ),
|
||||||
|
new Batch( "insert into GEOGRAPHIC_AREA (SHAPE_ID, TOP_LEVEL_ID, id) values (?, ?, ?)", 2 )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
import javax.persistence.AccessType;
|
import javax.persistence.AccessType;
|
||||||
|
@ -28,47 +27,24 @@ import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.BatchSize;
|
import org.hibernate.annotations.BatchSize;
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithSingleTableInheritance
|
public class InsertOrderingWithSingleTableInheritance extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( false, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class, SpecialPerson.class };
|
return new Class<?>[] { Address.class, Person.class, SpecialPerson.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -99,10 +75,10 @@ public class InsertOrderingWithSingleTableInheritance
|
||||||
specialPerson.addAddress( new Address() );
|
specialPerson.addAddress( new Address() );
|
||||||
session.persist( specialPerson );
|
session.persist( specialPerson );
|
||||||
}
|
}
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
assertEquals( 3, connectionProvider.getPreparedStatements().size() );
|
verifyPreparedStatementCount( 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.persistence.Access;
|
import javax.persistence.Access;
|
||||||
import javax.persistence.AccessType;
|
import javax.persistence.AccessType;
|
||||||
|
@ -28,47 +27,24 @@ import javax.persistence.SequenceGenerator;
|
||||||
import javax.persistence.Table;
|
import javax.persistence.Table;
|
||||||
|
|
||||||
import org.hibernate.annotations.BatchSize;
|
import org.hibernate.annotations.BatchSize;
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithTablePerClassInheritance
|
public class InsertOrderingWithTablePerClassInheritance extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( false, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class, SpecialPerson.class };
|
return new Class<?>[] { Address.class, Person.class, SpecialPerson.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -99,10 +75,10 @@ public class InsertOrderingWithTablePerClassInheritance
|
||||||
specialPerson.addAddress( new Address() );
|
specialPerson.addAddress( new Address() );
|
||||||
session.persist( specialPerson );
|
session.persist( specialPerson );
|
||||||
}
|
}
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
assertEquals( 3, connectionProvider.getPreparedStatements().size() );
|
verifyPreparedStatementCount( 3 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,9 +6,6 @@
|
||||||
*/
|
*/
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.util.Map;
|
|
||||||
import javax.persistence.CascadeType;
|
import javax.persistence.CascadeType;
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
|
@ -18,52 +15,27 @@ import javax.persistence.Id;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.SequenceGenerator;
|
import javax.persistence.SequenceGenerator;
|
||||||
|
|
||||||
import org.hibernate.cfg.Environment;
|
|
||||||
|
|
||||||
import org.hibernate.testing.DialectChecks;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.testing.RequiresDialectFeature;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
import org.hibernate.testing.TestForIssue;
|
import org.hibernate.testing.TestForIssue;
|
||||||
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.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Vlad Mihalcea
|
* @author Vlad Mihalcea
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-9864")
|
@TestForIssue(jiraKey = "HHH-9864")
|
||||||
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
public class InsertOrderingWithUnidirectionalOneToOne
|
public class InsertOrderingWithUnidirectionalOneToOne extends BaseInsertOrderingTest {
|
||||||
extends BaseNonConfigCoreFunctionalTestCase {
|
|
||||||
|
|
||||||
private PreparedStatementSpyConnectionProvider connectionProvider = new PreparedStatementSpyConnectionProvider( true, false );
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Class[] getAnnotatedClasses() {
|
protected Class<?>[] getAnnotatedClasses() {
|
||||||
return new Class[] { Address.class, Person.class };
|
return new Class<?>[] { Address.class, Person.class };
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addSettings(Map settings) {
|
|
||||||
settings.put( Environment.ORDER_INSERTS, "true" );
|
|
||||||
settings.put( Environment.STATEMENT_BATCH_SIZE, "10" );
|
|
||||||
settings.put(
|
|
||||||
org.hibernate.cfg.AvailableSettings.CONNECTION_PROVIDER,
|
|
||||||
connectionProvider
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void releaseResources() {
|
|
||||||
super.releaseResources();
|
|
||||||
connectionProvider.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatching() throws SQLException {
|
public void testBatching() {
|
||||||
doInHibernate( this::sessionFactory, session -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
Person worker = new Person();
|
Person worker = new Person();
|
||||||
Person homestay = new Person();
|
Person homestay = new Person();
|
||||||
|
@ -78,17 +50,13 @@ public class InsertOrderingWithUnidirectionalOneToOne
|
||||||
session.persist( home );
|
session.persist( home );
|
||||||
session.persist( office );
|
session.persist( office );
|
||||||
|
|
||||||
connectionProvider.clear();
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
PreparedStatement addressPreparedStatement = connectionProvider.getPreparedStatement(
|
verifyContainsBatches(
|
||||||
"insert into Address (person_ID, ID) values (?, ?)" );
|
new Batch( "insert into Address (person_ID, ID) values (?, ?)", 2 ),
|
||||||
verify( addressPreparedStatement, times( 2 ) ).addBatch();
|
new Batch( "insert into Person (ID) values (?)", 2 )
|
||||||
verify( addressPreparedStatement, times( 1 ) ).executeBatch();
|
);
|
||||||
PreparedStatement personPreparedStatement = connectionProvider.getPreparedStatement(
|
|
||||||
"insert into Person (ID) values (?)" );
|
|
||||||
verify( personPreparedStatement, times( 2 ) ).addBatch();
|
|
||||||
verify( personPreparedStatement, times( 1 ) ).executeBatch();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Entity(name = "Address")
|
@Entity(name = "Address")
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
package org.hibernate.test.insertordering;
|
package org.hibernate.test.insertordering;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.persistence.Column;
|
import javax.persistence.Column;
|
||||||
import javax.persistence.Embeddable;
|
import javax.persistence.Embeddable;
|
||||||
import javax.persistence.EmbeddedId;
|
import javax.persistence.EmbeddedId;
|
||||||
|
@ -18,20 +16,20 @@ import javax.persistence.JoinColumn;
|
||||||
import javax.persistence.OneToOne;
|
import javax.persistence.OneToOne;
|
||||||
import javax.persistence.Query;
|
import javax.persistence.Query;
|
||||||
|
|
||||||
import org.hibernate.cfg.AvailableSettings;
|
import org.hibernate.testing.DialectChecks;
|
||||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
import org.hibernate.testing.RequiresDialectFeature;
|
||||||
|
import org.hibernate.testing.TestForIssue;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import org.hibernate.testing.TestForIssue;
|
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||||
|
|
||||||
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Chris Cranford
|
* @author Chris Cranford
|
||||||
*/
|
*/
|
||||||
@TestForIssue(jiraKey = "HHH-12569")
|
@TestForIssue(jiraKey = "HHH-12569")
|
||||||
public class InsertOrderingWithUnidirectionalOneToOneJoinColumn extends BaseEntityManagerFunctionalTestCase {
|
@RequiresDialectFeature(DialectChecks.SupportsJdbcDriverProxying.class)
|
||||||
|
public class InsertOrderingWithUnidirectionalOneToOneJoinColumn extends BaseInsertOrderingTest {
|
||||||
@Embeddable
|
@Embeddable
|
||||||
public static class PersonAddressId implements Serializable {
|
public static class PersonAddressId implements Serializable {
|
||||||
@Column(name = "id")
|
@Column(name = "id")
|
||||||
|
@ -90,30 +88,31 @@ public class InsertOrderingWithUnidirectionalOneToOneJoinColumn extends BaseEnti
|
||||||
return new Class<?>[] { Person.class, Address.class };
|
return new Class<?>[] { Person.class, Address.class };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void addConfigOptions(Map options) {
|
|
||||||
super.addConfigOptions( options );
|
|
||||||
options.put( AvailableSettings.ORDER_INSERTS, "true" );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchingWithEmbeddableId() {
|
public void testBatchingWithEmbeddableId() {
|
||||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
final PersonAddressId id = new PersonAddressId();
|
final PersonAddressId id = new PersonAddressId();
|
||||||
id.setId( 1 );
|
id.setId( 1 );
|
||||||
|
|
||||||
Person person = new Person();
|
Person person = new Person();
|
||||||
person.setId( id );
|
person.setId( id );
|
||||||
entityManager.persist( person );
|
session.persist( person );
|
||||||
|
|
||||||
Address address = new Address();
|
Address address = new Address();
|
||||||
address.setId( id );
|
address.setId( id );
|
||||||
address.setPerson( person );
|
address.setPerson( person );
|
||||||
entityManager.persist( address );
|
session.persist( address );
|
||||||
|
|
||||||
|
clearBatches();
|
||||||
} );
|
} );
|
||||||
|
|
||||||
doInJPA( this::entityManagerFactory, entityManager -> {
|
verifyContainsBatches(
|
||||||
Query query = entityManager.createQuery( "FROM Person" );
|
new Batch( "insert into Person (id) values (?)" ),
|
||||||
|
new Batch( "insert into Address (id) values (?)" )
|
||||||
|
);
|
||||||
|
|
||||||
|
doInHibernate( this::sessionFactory, session -> {
|
||||||
|
Query query = session.createQuery( "FROM Person" );
|
||||||
assertEquals( 1, query.getResultList().size() );
|
assertEquals( 1, query.getResultList().size() );
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,11 +157,11 @@ public class PreparedStatementSpyConnectionProvider extends ConnectionProviderDe
|
||||||
List<PreparedStatement> preparedStatements = getPreparedStatements( sql );
|
List<PreparedStatement> preparedStatements = getPreparedStatements( sql );
|
||||||
if ( preparedStatements.isEmpty() ) {
|
if ( preparedStatements.isEmpty() ) {
|
||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"There is no PreparedStatement for this SQL statement " + sql );
|
"There is no PreparedStatement for this SQL statement: " + sql );
|
||||||
}
|
}
|
||||||
else if ( preparedStatements.size() > 1 ) {
|
else if ( preparedStatements.size() > 1 ) {
|
||||||
throw new IllegalArgumentException( "There are " + preparedStatements
|
throw new IllegalArgumentException( "There are " + preparedStatements
|
||||||
.size() + " PreparedStatements for this SQL statement " + sql );
|
.size() + " PreparedStatements for this SQL statement: " + sql );
|
||||||
}
|
}
|
||||||
return preparedStatements.get( 0 );
|
return preparedStatements.get( 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -300,8 +300,6 @@ task changeLogFile( dependsOn: [releaseChecks] ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
task addVersionCommit( dependsOn: [changeLogFile] ) {
|
task addVersionCommit( dependsOn: [changeLogFile] ) {
|
||||||
group = "Release"
|
group = "Release"
|
||||||
description = "Adds a commit for the released version and push the changes to github"
|
description = "Adds a commit for the released version and push the changes to github"
|
||||||
|
@ -414,15 +412,14 @@ class ChangeLogFile {
|
||||||
}
|
}
|
||||||
def apiString = "https://hibernate.atlassian.net/rest/api/2/search/?jql=project=HHH%20AND%20fixVersion=${restReleaseVersion}%20order%20by%20issuetype%20ASC"
|
def apiString = "https://hibernate.atlassian.net/rest/api/2/search/?jql=project=HHH%20AND%20fixVersion=${restReleaseVersion}%20order%20by%20issuetype%20ASC"
|
||||||
def apiUrl = new URL( apiString )
|
def apiUrl = new URL( apiString )
|
||||||
def releseNotes = new JsonSlurper().parse( apiUrl )
|
def jsonReleaseNotes = new JsonSlurper().parse( apiUrl )
|
||||||
|
|
||||||
|
|
||||||
def releaseDate = new Date().format( 'MMMM dd, YYYY' )
|
def releaseDate = new Date().format( 'MMMM dd, YYYY' )
|
||||||
def versionId = releseNotes.issues.get( 0 ).fields.fixVersions.get( 0 ).id
|
def versionId = getVersionId( jsonReleaseNotes, restReleaseVersion )
|
||||||
|
|
||||||
ReleaseNote releaseNotes = new ReleaseNote( releaseVersion, releaseDate, versionId )
|
ReleaseNote releaseNotes = new ReleaseNote( releaseVersion, releaseDate, versionId )
|
||||||
|
|
||||||
def issuetype
|
def issuetype
|
||||||
releseNotes.issues.each {
|
jsonReleaseNotes.issues.each {
|
||||||
issue ->
|
issue ->
|
||||||
if ( issuetype != issue.fields.issuetype.name ) {
|
if ( issuetype != issue.fields.issuetype.name ) {
|
||||||
issuetype = issue.fields.issuetype.name
|
issuetype = issue.fields.issuetype.name
|
||||||
|
@ -434,6 +431,17 @@ class ChangeLogFile {
|
||||||
releaseNotes.addEmptyLine()
|
releaseNotes.addEmptyLine()
|
||||||
return releaseNotes.notes
|
return releaseNotes.notes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static getVersionId(jsonReleaseNotes, String restReleaseVersion) {
|
||||||
|
def fixVersions = jsonReleaseNotes.issues.get( 0 ).fields.fixVersions
|
||||||
|
|
||||||
|
for ( def fixVersion : fixVersions ) {
|
||||||
|
if ( fixVersion.name.equals( restReleaseVersion ) ) {
|
||||||
|
return fixVersion.id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new GradleException( "Unable to determine the version id of the current release." )
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class ReleaseNote {
|
class ReleaseNote {
|
||||||
|
|
Loading…
Reference in New Issue