HHH-13656 Con not build and run test on Eclipse IDE

Eclipse windows
This commit is contained in:
hailtondecastro 2019-10-23 17:19:31 -03:00 committed by Steve Ebersole
parent 9f8a312841
commit f6fad942df
50 changed files with 381 additions and 55 deletions

1
gradle.properties Normal file
View File

@ -0,0 +1 @@
org.gradle.jvmargs=-Duser.language=en_US -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Duser.country=US

View File

@ -109,6 +109,7 @@ ext {
junit5_params : "org.junit.jupiter:junit-jupiter-params:${junit5Version}", junit5_params : "org.junit.jupiter:junit-jupiter-params:${junit5Version}",
junit: "junit:junit:${junitVersion}", junit: "junit:junit:${junitVersion}",
junit5_vintage: "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}", junit5_vintage: "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}",
junit_pcomms: "org.junit.platform:junit-platform-commons:1.5.2",
log4j: "log4j:log4j:1.2.17", log4j: "log4j:log4j:1.2.17",

3
hibernate-core/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/hibernate-core-IdeTests.launch
/hibernate-core-RunnableIdeTest.launch
/.externalToolBuilders/

View File

@ -4,7 +4,11 @@
* 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>.
*/ */
import groovy.xml.*
import org.apache.tools.ant.filters.ReplaceTokens import org.apache.tools.ant.filters.ReplaceTokens
import org.gradle.plugins.ide.eclipse.model.SourceFolder
import org.gradle.plugins.ide.eclipse.model.Library
import org.apache.tools.ant.taskdefs.condition.Os
apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply from: rootProject.file( 'gradle/published-java-module.gradle' )
apply plugin: Antlr4Plugin apply plugin: Antlr4Plugin
@ -18,6 +22,9 @@ configurations {
tests { tests {
description = 'Configuration for the produced test jar' description = 'Configuration for the produced test jar'
} }
eclipseConfig {
}
} }
dependencies { dependencies {
@ -51,6 +58,17 @@ dependencies {
provided( libraries.jacc ) provided( libraries.jacc )
provided( libraries.validation ) provided( libraries.validation )
provided( libraries.ant ) provided( libraries.ant )
eclipseConfig( compileOnly( libraries.ant ) )
eclipseConfig( compileOnly( libraries.logging_annotations ) )
eclipseConfig( runtime( libraries.junit ) )
eclipseConfig( runtime( libraries.junit5_api ) )
eclipseConfig( runtime( libraries.junit5_jupiter ) )
eclipseConfig( runtime( libraries.junit5_params ) )
eclipseConfig( runtime( libraries.junit_pcomms ) )
runtime( libraries.junit5_vintage )
runtime( libraries.junit5_jupiter )
provided( libraries.cdi ) provided( libraries.cdi )
testCompile( project(':hibernate-testing') ) testCompile( project(':hibernate-testing') )
@ -156,6 +174,157 @@ idea {
} }
} }
cleanEclipse {
project.delete '.externalToolBuilders'
project.delete 'hibernate-core-RunnableIdeTest.launch'
}
tasks.eclipse.dependsOn(cleanEclipse)
eclipse {
project {
file {
withXml { provider ->
def projectDescriptionNode = provider.asNode()
// projectDescriptionNode.children( ).each { nodeItem ->
// println( 'nodeItem: ' + nodeItem )
// }
def buildSpecNode = projectDescriptionNode.children().find { child -> child.name( ).equals('buildSpec') }
def buildCommandMkp = new StreamingMarkupBuilder().bind {
buildCommand {
name( 'org.eclipse.ui.externaltools.ExternalToolBuilder' )
triggers( 'full,incremental,' )
arguments( ) {
dictionary( ) {
key ( 'LaunchConfigHandle' )
value ( '<project>/.externalToolBuilders/gradlew_process_test_resources.launch' )
}
}
}
}
def buildCommandNode = new XmlParser().parseText( buildCommandMkp.toString() )
buildSpecNode.append( buildCommandNode )
}
}
}
mkdir '.externalToolBuilders'
file('.externalToolBuilders/gradlew_process_test_resources.launch').withWriter { writer ->
// Create MarkupBuilder with 4 space indent
def xml = new MarkupBuilder(new IndentPrinter(writer, " ", true))
xml.doubleQuotes = true
xml.mkp.xmlDeclaration(version: '1.0', encoding: 'utf-8', standalone: 'no')
xml.launchConfiguration( type: 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType' ) {
stringAttribute( key: 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', value: "${project.name}" )
booleanAttribute( key: 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', value: 'false' )
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_LOCATION', value: file('../gradlew.bat').absolutePath )
} else {
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_LOCATION', value: file('../gradlew').absolutePath )
}
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', value: 'incremental,auto,' )
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', value: 'hibernate-core:processTestResources --no-daemon' )
booleanAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', value: 'true' )
stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', value: file('../').absolutePath )
}
xml.mkp.comment("AUTO-GENERATED FILE. DO NOT MODIFY. This is generated by gradle eclipse task")
}
file('hibernate-core-RunnableIdeTest.launch').withWriter { writer ->
// Create MarkupBuilder with 4 space indent
def xml = new MarkupBuilder(new IndentPrinter(writer, " ", true))
xml.doubleQuotes = true
xml.mkp.xmlDeclaration(version: '1.0', encoding: 'utf-8', standalone: 'no')
xml.launchConfiguration( type: 'org.eclipse.jdt.junit.launchconfig' ) {
listAttribute( key: 'org.eclipse.debug.core.MAPPED_RESOURCE_PATHS' ) {
listEntry( value: "${project.name}" )
}
listAttribute( key: 'org.eclipse.debug.core.MAPPED_RESOURCE_TYPES' ) {
listEntry( value: '4' )
}
stringAttribute( key: 'org.eclipse.jdt.junit.CONTAINER', value: "=${project.name}" )
stringAttribute( key: 'org.eclipse.jdt.junit.EXCLUDE_TAGS', value: '' )
booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_EXCLUDE_TAGS', value: 'false' )
booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_INCLUDE_TAGS', value: 'true' )
stringAttribute( key: 'org.eclipse.jdt.junit.INCLUDE_TAGS', value: 'RunnableIdeTest' )
booleanAttribute( key: 'org.eclipse.jdt.junit.KEEPRUNNING_ATTR', value: 'false' )
stringAttribute( key: 'org.eclipse.jdt.junit.TESTNAME', value: '' )
stringAttribute( key: 'org.eclipse.jdt.junit.TEST_KIND', value: 'org.eclipse.jdt.junit.loader.junit5' )
stringAttribute( key: 'org.eclipse.jdt.launching.MAIN_TYPE', value: '' )
stringAttribute( key: 'org.eclipse.jdt.launching.PROJECT_ATTR', value: 'hibernate-core' )
stringAttribute( key: 'org.eclipse.jdt.launching.VM_ARGUMENTS', value: '-ea' )
}
xml.mkp.comment("AUTO-GENERATED FILE. DO NOT MODIFY. This is generated by gradle eclipse task")
}
classpath {
plusConfigurations += [
configurations.eclipseConfig
]
def frf = it.fileReferenceFactory
file {
beforeMerged { classpath ->
}
whenMerged { classpath ->
Set exclusionSourceSet = [
'src/main/resources',
'src/test/resources'
]
List newSourceSet = []
classpath.entries.each { item ->
if( !exclusionSourceSet.contains( item.path ) ) {
println( 'INCLUDING: ' + item )
newSourceSet.add( item )
} else {
println( 'NOT INCLUDING: ' + item )
}
}
def aptMain = new SourceFolder('target/generated-src/apt/main', 'bin/main')
def aptTest = new SourceFolder('target/generated-src/apt/test', 'bin/test')
def resourceMain = new SourceFolder('src/main/resources', 'target/resources/main')
def resourceTest = new SourceFolder('src/test/resources', 'target/resources/test')
newSourceSet += [
aptMain,
aptTest,
resourceMain,
resourceTest
]
// def resourceMain = new Library( frf.fromFile( file ( 'target/resources/main' ) ) )
// def resourceTest = new Library( frf.fromFile( file ( 'target/resources/test' ) ) )
println( 'newSourceSet:' )
println( newSourceSet )
classpath.entries = newSourceSet
// classpath.configure([
// aptMain,
// aptTest,
// resourceMain,
// resourceTest
// ])
// Find the "source" entry and add the exclude for the folder containing our super-source code
// Set exclusionSourceSet = [
// 'src/main/resources',
// 'src/test/resources'
// ]
// Set newSourceSet = []
// classpath.entries.each { item ->
// if( !exclusionSourceSet.contains( item.path ) ) {
// println( 'INCLUDING: ' + item )
// newSourceSet.add( item )
// } else {
// println( 'NOT INCLUDING: ' + item )
// }
// }
// println( 'newSourceSet:' )
// println( newSourceSet )
}
}
}
}
xjc { xjc {
outputDir = project.jaxbTargetDir outputDir = project.jaxbTargetDir
@ -190,7 +359,8 @@ task copyBundleResources (type: Copy) {
from file('src/test/bundles') from file('src/test/bundles')
into ext.bundlesTargetDir into ext.bundlesTargetDir
filter( ReplaceTokens, tokens: ext.bundleTokens) filter( ReplaceTokens, tokens: ext.bundleTokens)
//println( 'ext: ' + ext )
//println( 'ext.bundleTokens:' + ext.bundleTokens )
doFirst { doFirst {
ext.bundlesTargetDir.mkdirs() ext.bundlesTargetDir.mkdirs()
} }

View File

@ -373,7 +373,7 @@ public class MetadataContext {
else if ( persistentClass.hasIdentifierMapper() ) { else if ( persistentClass.hasIdentifierMapper() ) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
final Iterator<Property> propertyIterator = persistentClass.getIdentifierMapper().getPropertyIterator(); final Iterator<Property> propertyIterator = persistentClass.getIdentifierMapper().getPropertyIterator();
final Set<SingularPersistentAttribute<?, ?>> idClassAttributes = (Set<SingularPersistentAttribute<?, ?>>) buildIdClassAttributes( final Set<SingularPersistentAttribute<?, ?>> idClassAttributes = (Set<SingularPersistentAttribute<?, ?>>)(Object) buildIdClassAttributes(
identifiableType, identifiableType,
propertyIterator propertyIterator
); );

View File

@ -2419,7 +2419,7 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre
//noinspection unchecked //noinspection unchecked
return getFunctionTemplate("trim").makeSqmFunctionExpression( return getFunctionTemplate("trim").makeSqmFunctionExpression(
asList( (List<SqmTypedNode<?>>)(Object)asList(
interpretTrimSpecification( ctx.trimSpecification() ), interpretTrimSpecification( ctx.trimSpecification() ),
visitTrimCharacter( ctx.trimCharacter() ), visitTrimCharacter( ctx.trimCharacter() ),
source source

View File

@ -22,6 +22,7 @@ import org.junit.Test;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -66,7 +67,7 @@ public class DB2390DialectTestCase extends BaseEntityManagerFunctionalTestCase {
@Before @Before
public void populateSchema() { public void populateSchema() {
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 0; i < 10; ++i ) { for ( int i = 0; i < 10; ++i ) {
final SimpleEntity simpleEntity = new SimpleEntity( i, "Entity" + i ); final SimpleEntity simpleEntity = new SimpleEntity( i, "Entity" + i );
entityManager.persist( simpleEntity ); entityManager.persist( simpleEntity );

View File

@ -13,6 +13,7 @@ import org.hibernate.dialect.InformixDialect;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -126,7 +127,7 @@ public class InformixFunctionTest extends BaseCoreFunctionalTestCase {
@Test @Test
@TestForIssue( jiraKey = "HHH-10800" ) @TestForIssue( jiraKey = "HHH-10800" )
public void testCurrentTimestamp() throws Exception { public void testCurrentTimestamp() throws Exception {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
int tries = 2; int tries = 2;
while ( tries-- > 0 ) { while ( tries-- > 0 ) {
Timestamp timestamp = (Timestamp) session.createQuery( Timestamp timestamp = (Timestamp) session.createQuery(

View File

@ -32,6 +32,7 @@ import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.logger.LoggerInspectionRule; import org.hibernate.testing.logger.LoggerInspectionRule;
import org.hibernate.testing.logger.Triggerable; import org.hibernate.testing.logger.Triggerable;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -118,7 +119,7 @@ public class PostgreSQLSequenceGeneratorWithSerialTest extends BaseEntityManager
final int ITERATIONS = 51; final int ITERATIONS = 51;
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 1; i <= ITERATIONS; i++ ) { for ( int i = 1; i <= ITERATIONS; i++ ) {
ApplicationConfiguration model = new ApplicationConfiguration(); ApplicationConfiguration model = new ApplicationConfiguration();

View File

@ -37,6 +37,7 @@ import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.logger.LoggerInspectionRule; import org.hibernate.testing.logger.LoggerInspectionRule;
import org.hibernate.testing.logger.Triggerable; import org.hibernate.testing.logger.Triggerable;
import org.hibernate.testing.transaction.TransactionUtil;
import org.hibernate.test.schemaupdate.SchemaExportWithGlobalQuotingEnabledTest; import org.hibernate.test.schemaupdate.SchemaExportWithGlobalQuotingEnabledTest;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -113,7 +114,7 @@ public class SequenceMismatchStrategyFixWithSequenceGeneratorTest extends BaseEn
final int ITERATIONS = 51; final int ITERATIONS = 51;
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 1; i <= ITERATIONS; i++ ) { for ( int i = 1; i <= ITERATIONS; i++ ) {
ApplicationConfiguration model = new ApplicationConfiguration(); ApplicationConfiguration model = new ApplicationConfiguration();

View File

@ -31,6 +31,7 @@ import org.hibernate.testing.RequiresDialectFeature;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.logger.LoggerInspectionRule; import org.hibernate.testing.logger.LoggerInspectionRule;
import org.hibernate.testing.logger.Triggerable; import org.hibernate.testing.logger.Triggerable;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
@ -105,7 +106,7 @@ public class SequenceMismatchStrategyWithoutSequenceGeneratorTest extends BaseEn
final int ITERATIONS = 51; final int ITERATIONS = 51;
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 1; i <= ITERATIONS; i++ ) { for ( int i = 1; i <= ITERATIONS; i++ ) {
ApplicationConfiguration model = new ApplicationConfiguration(); ApplicationConfiguration model = new ApplicationConfiguration();

View File

@ -16,6 +16,7 @@ import org.hibernate.Hibernate;
import org.hibernate.graph.RootGraph; import org.hibernate.graph.RootGraph;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -32,7 +33,7 @@ public class FetchWithRootGraphTest extends BaseCoreFunctionalTestCase {
@Before @Before
public void before() { public void before() {
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
for ( long i = 0; i < 10; ++i ) { for ( long i = 0; i < 10; ++i ) {
SimpleEntity sim = new SimpleEntity( i, "Entity #" + i ); SimpleEntity sim = new SimpleEntity( i, "Entity #" + i );
EntityWithReference ref = new EntityWithReference( i, sim ); EntityWithReference ref = new EntityWithReference( i, sim );

View File

@ -19,7 +19,7 @@ import javax.persistence.TableGenerator;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.jdbc.Work; import org.hibernate.jdbc.Work;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
@ -56,7 +56,7 @@ public class AssignedInitialValueTableGeneratorConfiguredTest extends BaseEntity
@Test @Test
public void testTheGeneratedIdValuesAreCorrect() { public void testTheGeneratedIdValuesAreCorrect() {
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( long i = 0; i < 3; i++ ) { for ( long i = 0; i < 3; i++ ) {
Product product = new Product(); Product product = new Product();
product.setName( "Hibernate " + i ); product.setName( "Hibernate " + i );

View File

@ -19,7 +19,7 @@ import javax.persistence.TableGenerator;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.jdbc.Work; import org.hibernate.jdbc.Work;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.CoreMatchers.notNullValue;
@ -57,7 +57,7 @@ public class DefaultInitialValueTableGeneratorConfiguredTest extends BaseEntityM
@Test @Test
public void testTheGeneratedIdValuesAreCorrect() { public void testTheGeneratedIdValuesAreCorrect() {
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( long i = 0; i < 3; i++ ) { for ( long i = 0; i < 3; i++ ) {
Product product = new Product(); Product product = new Product();
product.setName( "Hibernate " + i ); product.setName( "Hibernate " + i );

View File

@ -13,6 +13,8 @@ import org.hibernate.tool.schema.Action;
import org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator; import org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator;
import org.junit.Test; import org.junit.Test;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.MatcherAssert.assertThat;
@ -20,6 +22,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Tags({
@Tag("RunnableIdeTest"),
})
public class SchemaToolingAutoActionTests { public class SchemaToolingAutoActionTests {
@Test @Test
public void testLegacySettingAsAction() { public void testLegacySettingAsAction() {

View File

@ -6,8 +6,14 @@
*/ */
package org.hibernate.orm.test.bootstrap.jpa; package org.hibernate.orm.test.bootstrap.jpa;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import java.util.Collections; import java.util.Collections;
import java.util.Map; import java.util.Map;
import javax.persistence.EntityManagerFactory; import javax.persistence.EntityManagerFactory;
import javax.persistence.spi.PersistenceProvider; import javax.persistence.spi.PersistenceProvider;
import javax.sql.DataSource; import javax.sql.DataSource;
@ -17,22 +23,20 @@ import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProvid
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.jpa.HibernatePersistenceProvider; import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hibernate.testing.jdbc.DataSourceStub;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.jdbc.DataSourceStub;
import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter; import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter;
import org.junit.Test; import org.junit.Test;
import org.junit.jupiter.api.Tag;
import static org.hamcrest.CoreMatchers.instanceOf; import org.junit.jupiter.api.Tags;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Tags({
@Tag("RunnableIdeTest"),
})
public class PersistenceUnitInfoTests extends BaseUnitTestCase { public class PersistenceUnitInfoTests extends BaseUnitTestCase {
@Test @Test
@TestForIssue( jiraKey = "HHH-13432" ) @TestForIssue( jiraKey = "HHH-13432" )

View File

@ -35,6 +35,8 @@ import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.hibernate.testing.util.jpa.DelegatingPersistenceUnitInfo; import org.hibernate.testing.util.jpa.DelegatingPersistenceUnitInfo;
import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter; import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter;
import org.junit.Test; import org.junit.Test;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -46,6 +48,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Tags({
@Tag("RunnableIdeTest"),
})
public class PersistenceUnitOverridesTests extends BaseUnitTestCase { public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
@Test @Test

View File

@ -20,6 +20,8 @@ import org.hibernate.testing.orm.junit.SessionFactoryFunctionalTesting;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.hamcrest.MatcherAssert; import org.hamcrest.MatcherAssert;
@ -38,6 +40,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
@SessionFactory @SessionFactory
@SessionFactoryFunctionalTesting @SessionFactoryFunctionalTesting
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class LoadingSmokeTests { public class LoadingSmokeTests {
@Test @Test
public void testBasicLoad(SessionFactoryScope scope) { public void testBasicLoad(SessionFactoryScope scope) {

View File

@ -23,6 +23,8 @@ import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -43,6 +45,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
) )
@ServiceRegistry @ServiceRegistry
@SessionFactory @SessionFactory
@Tags({
@Tag("RunnableIdeTest"),
})
public class SingleTableInheritanceTests { public class SingleTableInheritanceTests {
@Test @Test
public void basicTest(SessionFactoryScope scope) { public void basicTest(SessionFactoryScope scope) {

View File

@ -35,6 +35,8 @@ import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -51,6 +53,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
) )
@ServiceRegistry @ServiceRegistry
@SessionFactory @SessionFactory
@Tags({
@Tag("RunnableIdeTest"),
})
public class SmokeTests { public class SmokeTests {
@Test @Test

View File

@ -27,10 +27,15 @@ import org.hibernate.sql.exec.spi.JdbcParameter;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.junit.Test; import org.junit.Test;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Tags({
@Tag("RunnableIdeTest"),
})
public class BasicCriteriaExecutionTests extends BaseNonConfigCoreFunctionalTestCase { public class BasicCriteriaExecutionTests extends BaseNonConfigCoreFunctionalTestCase {
@Override @Override

View File

@ -21,6 +21,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelection;
import org.hibernate.testing.orm.domain.gambit.EntityWithManyToOneSelfReference; import org.hibernate.testing.orm.domain.gambit.EntityWithManyToOneSelfReference;
import org.hibernate.testing.orm.domain.gambit.SimpleEntity; import org.hibernate.testing.orm.domain.gambit.SimpleEntity;
import org.hibernate.testing.orm.junit.ExpectedException; import org.hibernate.testing.orm.junit.ExpectedException;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -37,6 +39,9 @@ import static org.hibernate.testing.hamcrest.CollectionMatchers.isEmpty;
* @author Andrea Boriero * @author Andrea Boriero
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class AliasCollisionTest extends BaseSqmUnitTest { public class AliasCollisionTest extends BaseSqmUnitTest {
@Override @Override

View File

@ -20,7 +20,8 @@ import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.query.sqm.tree.select.SqmSelectableNode; import org.hibernate.query.sqm.tree.select.SqmSelectableNode;
import org.hibernate.query.sqm.tree.select.SqmSelection; import org.hibernate.query.sqm.tree.select.SqmSelection;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -32,6 +33,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class AttributePathTests extends BaseSqmUnitTest { public class AttributePathTests extends BaseSqmUnitTest {
@Override @Override

View File

@ -19,6 +19,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelectableNode;
import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.FailureExpected;
import org.hibernate.testing.orm.junit.TestingUtil; import org.hibernate.testing.orm.junit.TestingUtil;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -32,6 +34,9 @@ import static org.junit.Assert.assertEquals;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class CaseExpressionsTest extends BaseSqmUnitTest { public class CaseExpressionsTest extends BaseSqmUnitTest {
@Override @Override

View File

@ -20,6 +20,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.testing.orm.domain.gambit.EntityOfBasics; import org.hibernate.testing.orm.domain.gambit.EntityOfBasics;
import org.hibernate.testing.orm.junit.TestingUtil; import org.hibernate.testing.orm.junit.TestingUtil;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.equalTo;
@ -34,6 +36,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class DynamicInstantiationTests extends BaseSqmUnitTest { public class DynamicInstantiationTests extends BaseSqmUnitTest {
@Override @Override

View File

@ -17,7 +17,8 @@ import org.hibernate.query.sqm.tree.from.SqmRoot;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.query.sqm.tree.select.SqmSelection; import org.hibernate.query.sqm.tree.select.SqmSelection;
import org.hibernate.query.sqm.tree.select.SqmSortSpecification; import org.hibernate.query.sqm.tree.select.SqmSortSpecification;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.containsString;
@ -38,6 +39,9 @@ import static org.junit.jupiter.api.Assertions.fail;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class FromClauseTests extends BaseSqmUnitTest { public class FromClauseTests extends BaseSqmUnitTest {
@Override @Override

View File

@ -11,11 +11,16 @@ import org.hibernate.orm.test.query.sqm.BaseSqmUnitTest;
import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.testing.orm.domain.StandardDomainModel; import org.hibernate.testing.orm.domain.StandardDomainModel;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Tags({
@Tag("RunnableIdeTest"),
})
public class LiteralTests extends BaseSqmUnitTest { public class LiteralTests extends BaseSqmUnitTest {
@Override @Override

View File

@ -13,6 +13,8 @@ import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hibernate.orm.test.query.sqm.BaseSqmUnitTest.interpretSelect; import static org.hibernate.orm.test.query.sqm.BaseSqmUnitTest.interpretSelect;
@ -31,6 +33,9 @@ import static org.hibernate.orm.test.query.sqm.BaseSqmUnitTest.interpretSelect;
) )
) )
@SessionFactory @SessionFactory
@Tags({
@Tag("RunnableIdeTest"),
})
public class PagingTests { public class PagingTests {
@Test @Test

View File

@ -31,6 +31,8 @@ import org.hibernate.sql.exec.spi.DomainParameterBindingContext;
import org.hibernate.testing.orm.junit.ExpectedException; import org.hibernate.testing.orm.junit.ExpectedException;
import org.hibernate.testing.orm.junit.ExpectedExceptionExtension; import org.hibernate.testing.orm.junit.ExpectedExceptionExtension;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
@ -47,6 +49,9 @@ import static org.hibernate.testing.hamcrest.CollectionMatchers.hasSize;
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@ExtendWith( ExpectedExceptionExtension.class ) @ExtendWith( ExpectedExceptionExtension.class )
@Tags({
@Tag("RunnableIdeTest"),
})
public class ParameterTests extends BaseSqmUnitTest { public class ParameterTests extends BaseSqmUnitTest {
@Test @Test
@ExpectedException( SemanticException.class ) @ExpectedException( SemanticException.class )

View File

@ -12,6 +12,8 @@ import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
/** /**
@ -21,6 +23,9 @@ import org.junit.jupiter.api.Test;
@DomainModel( annotatedClasses = SmokeTests.SimpleEntity.class ) @DomainModel( annotatedClasses = SmokeTests.SimpleEntity.class )
@ServiceRegistry @ServiceRegistry
@SessionFactory( exportSchema = true ) @SessionFactory( exportSchema = true )
@Tags({
@Tag("RunnableIdeTest"),
})
public class QueryPlanCachingTest { public class QueryPlanCachingTest {
@Test @Test
public void testHqlTranslationCaching(SessionFactoryScope scope) { public void testHqlTranslationCaching(SessionFactoryScope scope) {

View File

@ -33,6 +33,8 @@ import org.hibernate.testing.orm.domain.gambit.EntityOfLists;
import org.hibernate.testing.orm.domain.gambit.EntityOfMaps; import org.hibernate.testing.orm.domain.gambit.EntityOfMaps;
import org.hibernate.testing.orm.domain.gambit.EntityOfSets; import org.hibernate.testing.orm.domain.gambit.EntityOfSets;
import org.hibernate.testing.orm.junit.TestingUtil; import org.hibernate.testing.orm.junit.TestingUtil;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.endsWith;
@ -49,6 +51,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class SelectClauseTests extends BaseSqmUnitTest { public class SelectClauseTests extends BaseSqmUnitTest {
@Test @Test

View File

@ -20,6 +20,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelectStatement;
import org.hibernate.testing.orm.domain.gambit.EntityOfLists; import org.hibernate.testing.orm.domain.gambit.EntityOfLists;
import org.hibernate.testing.orm.domain.gambit.EntityOfMaps; import org.hibernate.testing.orm.domain.gambit.EntityOfMaps;
import org.hibernate.testing.orm.domain.gambit.EntityOfSets; import org.hibernate.testing.orm.domain.gambit.EntityOfSets;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -33,6 +35,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
* @author Gunnar Morling * @author Gunnar Morling
*/ */
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@Tags({
@Tag("RunnableIdeTest"),
})
public class WhereClauseTests extends BaseSqmUnitTest { public class WhereClauseTests extends BaseSqmUnitTest {
@Override @Override

View File

@ -45,6 +45,8 @@ import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.endsWith; import static org.hamcrest.CoreMatchers.endsWith;
@ -69,6 +71,9 @@ import static org.hamcrest.MatcherAssert.assertThat;
) )
) )
@SessionFactory @SessionFactory
@Tags({
@Tag("RunnableIdeTest"),
})
public class SmokeTests { public class SmokeTests {
@Test @Test
public void testSimpleHqlInterpretation(SessionFactoryScope scope) { public void testSimpleHqlInterpretation(SessionFactoryScope scope) {

View File

@ -31,6 +31,8 @@ import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Tags;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import static org.hamcrest.CoreMatchers.instanceOf; import static org.hamcrest.CoreMatchers.instanceOf;
@ -61,6 +63,9 @@ import static org.hibernate.orm.test.metamodel.mapping.SmokeTests.Gender.MALE;
} }
) )
@SessionFactory( exportSchema = true ) @SessionFactory( exportSchema = true )
@Tags({
@Tag("RunnableIdeTest"),
})
public class SmokeTests { public class SmokeTests {
@BeforeEach @BeforeEach

View File

@ -16,6 +16,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.jdbc.SQLStatementInterceptor; import org.hibernate.testing.jdbc.SQLStatementInterceptor;
import org.hibernate.testing.transaction.TransactionUtil;
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider; import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
import org.junit.Test; import org.junit.Test;
@ -46,7 +47,7 @@ public class InClauseParameterPaddingTest extends BaseEntityManagerFunctionalTes
@Override @Override
protected void afterEntityManagerFactoryBuilt() { protected void afterEntityManagerFactoryBuilt() {
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 1; i < 10; i++ ) { for ( int i = 1; i < 10; i++ ) {
Person person = new Person(); Person person = new Person();
person.setId( i ); person.setId( i );

View File

@ -20,6 +20,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.jdbc.SQLStatementInterceptor; import org.hibernate.testing.jdbc.SQLStatementInterceptor;
import org.hibernate.testing.transaction.TransactionUtil;
import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider; import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider;
import org.junit.Test; import org.junit.Test;
@ -58,7 +59,7 @@ public class MaxInExpressionParameterPaddingTest extends BaseEntityManagerFuncti
@Override @Override
protected void afterEntityManagerFactoryBuilt() { protected void afterEntityManagerFactoryBuilt() {
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 0; i < MAX_COUNT; i++ ) { for ( int i = 0; i < MAX_COUNT; i++ ) {
Person person = new Person(); Person person = new Person();
person.setId( i ); person.setId( i );

View File

@ -37,6 +37,7 @@ import org.hibernate.annotations.UpdateTimestamp;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -62,7 +63,7 @@ public class AnnotationMappingJoinClassTest extends BaseCoreFunctionalTestCase {
@Override @Override
protected void prepareTest() { protected void prepareTest() {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
TaskStatus taskStatus = new TaskStatus(); TaskStatus taskStatus = new TaskStatus();
taskStatus.setName("Enabled"); taskStatus.setName("Enabled");
taskStatus.setDisplayName("Enabled"); taskStatus.setDisplayName("Enabled");

View File

@ -15,6 +15,7 @@ import org.hibernate.query.Query;
import org.hibernate.testing.FailureExpected; import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -46,7 +47,7 @@ public class HbmMappingJoinClassTest extends BaseCoreFunctionalTestCase {
@Override @Override
protected void prepareTest() { protected void prepareTest() {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
TaskStatus taskStatus = new TaskStatus(); TaskStatus taskStatus = new TaskStatus();
taskStatus.setName("Enabled"); taskStatus.setName("Enabled");
taskStatus.setDisplayName("Enabled"); taskStatus.setDisplayName("Enabled");

View File

@ -18,6 +18,7 @@ import org.hibernate.stat.QueryStatistics;
import org.hibernate.stat.Statistics; import org.hibernate.stat.Statistics;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
@ -48,7 +49,7 @@ public class QueryPlanCacheStatisticsTest extends BaseEntityManagerFunctionalTes
SessionFactory sessionFactory = entityManagerFactory().unwrap( SessionFactory.class ); SessionFactory sessionFactory = entityManagerFactory().unwrap( SessionFactory.class );
statistics = sessionFactory.getStatistics(); statistics = sessionFactory.getStatistics();
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( long i = 1; i <= 5; i++ ) { for ( long i = 1; i <= 5; i++ ) {
if ( i % 3 == 0 ) { if ( i % 3 == 0 ) {
entityManager.flush(); entityManager.flush();

View File

@ -20,6 +20,7 @@ import javax.persistence.Version;
import org.hibernate.cfg.AvailableSettings; import org.hibernate.cfg.AvailableSettings;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -67,7 +68,7 @@ public class BatchOptimisticLockingTest extends
} ); } );
try { try {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
List<Person> persons = session.createQuery( "select p from Person p").getResultList(); List<Person> persons = session.createQuery( "select p from Person p").getResultList();
for ( int i = 0; i < persons.size(); i++ ) { for ( int i = 0; i < persons.size(); i++ ) {

View File

@ -28,6 +28,7 @@ import org.hibernate.persister.entity.EntityPersister;
import org.hibernate.resource.jdbc.spi.StatementInspector; import org.hibernate.resource.jdbc.spi.StatementInspector;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -157,7 +158,7 @@ public class BatchFetchNotFoundIgnoreDefaultStyleTest extends BaseCoreFunctional
public void testMostNotFoundFromQuery() { public void testMostNotFoundFromQuery() {
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
// delete all but last Task entity // delete all but last Task entity
for ( int i = 0; i < 7; i++ ) { for ( int i = 0; i < 7; i++ ) {
session.delete( tasks.get( i ) ); session.delete( tasks.get( i ) );

View File

@ -32,6 +32,7 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner; import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; import org.hibernate.testing.bytecode.enhancement.EnhancementOptions;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -131,7 +132,7 @@ public class LoadANonExistingEntityTest extends BaseNonConfigCoreFunctionalTestC
@Before @Before
public void setUpData() { public void setUpData() {
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) {
final Employee employee = new Employee(); final Employee employee = new Employee();
employee.id = i + 1; employee.id = i + 1;

View File

@ -39,6 +39,7 @@ import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner; import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner;
import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; import org.hibernate.testing.bytecode.enhancement.EnhancementOptions;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -67,7 +68,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu
statistics.clear(); statistics.clear();
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
List<Employee> employees = new ArrayList<>( NUMBER_OF_ENTITIES ); List<Employee> employees = new ArrayList<>( NUMBER_OF_ENTITIES );
for ( int i = 0 ; i < NUMBER_OF_ENTITIES ; i++ ) { for ( int i = 0 ; i < NUMBER_OF_ENTITIES ; i++ ) {
employees.add( session.load( Employee.class, i + 1 ) ); employees.add( session.load( Employee.class, i + 1 ) );
@ -93,7 +94,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu
statistics.clear(); statistics.clear();
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( int i = 0 ; i < NUMBER_OF_ENTITIES ; i++ ) { for ( int i = 0 ; i < NUMBER_OF_ENTITIES ; i++ ) {
Employee employee = session.get( Employee.class, i + 1 ); Employee employee = session.get( Employee.class, i + 1 );
assertNull( employee.employer ); assertNull( employee.employer );
@ -115,7 +116,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu
statistics.clear(); statistics.clear();
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) {
Employee employee = session.get( Employee.class, i + 1 ); Employee employee = session.get( Employee.class, i + 1 );
Employer employer = new Employer(); Employer employer = new Employer();
@ -127,7 +128,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu
); );
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) {
Employee employee = session.get( Employee.class, i + 1 ); Employee employee = session.get( Employee.class, i + 1 );
assertTrue( Hibernate.isInitialized( employee.employer ) ); assertTrue( Hibernate.isInitialized( employee.employer ) );
@ -149,7 +150,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu
@Before @Before
public void setUpData() { public void setUpData() {
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) {
final Employee employee = new Employee(); final Employee employee = new Employee();
employee.id = i + 1; employee.id = i + 1;

View File

@ -21,6 +21,7 @@ import org.junit.Test;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.transaction.TransactionUtil;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -54,7 +55,7 @@ public class SQLServerDialectPaginationTest extends BaseEntityManagerFunctionalT
@Test @Test
public void testPaginationQuery() { public void testPaginationQuery() {
// prepare some test data // prepare some test data
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> {
for ( int i = 1; i <= 20; ++i ) { for ( int i = 1; i <= 20; ++i ) {
final SimpleEntity entity = new SimpleEntity( i, "Entity" + i ); final SimpleEntity entity = new SimpleEntity( i, "Entity" + i );
entityManager.persist( entity ); entityManager.persist( entity );

View File

@ -29,6 +29,7 @@ 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.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -92,7 +93,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) { public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) {
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
for ( int i = 0; i < nEntities; i++ ) { for ( int i = 0; i < nEntities; i++ ) {
Employee e = new Employee(); Employee e = new Employee();
e.getId(); e.getId();
@ -110,7 +111,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
} }
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )
@ -122,7 +123,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
} }
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )
@ -139,7 +140,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
public void testAssertSubclassInsertedSuccessfullyAfterCommit() { public void testAssertSubclassInsertedSuccessfullyAfterCommit() {
final int nEntities = 10; final int nEntities = 10;
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
for ( int i = 0; i < nEntities; i++ ) { for ( int i = 0; i < nEntities; i++ ) {
Employee e = new Employee(); Employee e = new Employee();
e.setName( "Mark" ); e.setName( "Mark" );
@ -157,7 +158,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
Assert.assertEquals( nEntities, numberOfInsertedEmployee ); Assert.assertEquals( nEntities, numberOfInsertedEmployee );
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )
@ -190,7 +191,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )

View File

@ -27,6 +27,7 @@ import org.hibernate.cfg.Environment;
import org.hibernate.testing.TestForIssue; import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -88,7 +89,7 @@ public class JoinedSubclassBatchingTest extends BaseCoreFunctionalTestCase {
public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) { public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) {
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
for ( int i = 0; i < nEntities; i++ ) { for ( int i = 0; i < nEntities; i++ ) {
Employee e = new Employee(); Employee e = new Employee();
e.getId(); e.getId();
@ -106,7 +107,7 @@ public class JoinedSubclassBatchingTest extends BaseCoreFunctionalTestCase {
} }
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )
@ -118,7 +119,7 @@ public class JoinedSubclassBatchingTest extends BaseCoreFunctionalTestCase {
} }
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )

View File

@ -29,6 +29,7 @@ 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.BaseCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
@ -92,7 +93,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) { public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) {
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
for ( int i = 0; i < nEntities; i++ ) { for ( int i = 0; i < nEntities; i++ ) {
Employee e = new Employee(); Employee e = new Employee();
e.getId(); e.getId();
@ -110,7 +111,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
} }
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )
@ -122,7 +123,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
} }
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )
@ -154,7 +155,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa
} ); } );
doInHibernate( this::sessionFactory, s -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> {
int i = 0; int i = 0;
ScrollableResults sr = s.createQuery( ScrollableResults sr = s.createQuery(
"select e from Employee e" ) "select e from Employee e" )

View File

@ -18,6 +18,7 @@ import org.hibernate.query.Query;
import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
import org.hibernate.testing.transaction.TransactionUtil;
import org.junit.Test; import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@ -40,7 +41,7 @@ public abstract class AbstractSkipLockedTest
@RequiresDialect({ SQLServer2005Dialect.class }) @RequiresDialect({ SQLServer2005Dialect.class })
public void testSQLServerSkipLocked() { public void testSQLServerSkipLocked() {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( long i = 1; i <= 10; i++ ) { for ( long i = 1; i <= 10; i++ ) {
BatchJob batchJob = new BatchJob(); BatchJob batchJob = new BatchJob();
batchJob.setId( i ); batchJob.setId( i );
@ -73,7 +74,7 @@ public abstract class AbstractSkipLockedTest
@RequiresDialect({ PostgreSQL95Dialect.class }) @RequiresDialect({ PostgreSQL95Dialect.class })
public void testPostgreSQLSkipLocked() { public void testPostgreSQLSkipLocked() {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( long i = 1; i <= 10; i++ ) { for ( long i = 1; i <= 10; i++ ) {
BatchJob batchJob = new BatchJob(); BatchJob batchJob = new BatchJob();
batchJob.setId( i ); batchJob.setId( i );
@ -112,7 +113,7 @@ public abstract class AbstractSkipLockedTest
@RequiresDialect({ Oracle8iDialect.class }) @RequiresDialect({ Oracle8iDialect.class })
public void testOracleSkipLocked() { public void testOracleSkipLocked() {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( long i = 1; i <= 10; i++ ) { for ( long i = 1; i <= 10; i++ ) {
BatchJob batchJob = new BatchJob(); BatchJob batchJob = new BatchJob();
batchJob.setId( i ); batchJob.setId( i );
@ -147,7 +148,7 @@ public abstract class AbstractSkipLockedTest
@RequiresDialect({ MySQL8Dialect.class }) @RequiresDialect({ MySQL8Dialect.class })
public void testMySQLSkipLocked() { public void testMySQLSkipLocked() {
doInHibernate( this::sessionFactory, session -> { doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
for ( long i = 1; i <= 10; i++ ) { for ( long i = 1; i <= 10; i++ ) {
BatchJob batchJob = new BatchJob(); BatchJob batchJob = new BatchJob();
batchJob.setId( i ); batchJob.setId( i );

View File

@ -29,6 +29,7 @@ import org.hibernate.stat.Statistics;
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.testing.transaction.TransactionUtil;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
@ -85,7 +86,7 @@ public class MultiLoadSubSelectCollectionTest extends BaseNonConfigCoreFunctiona
@TestForIssue( jiraKey = "HHH-12740" ) @TestForIssue( jiraKey = "HHH-12740" )
public void testSubselect() { public void testSubselect() {
doInHibernate( doInHibernate(
this::sessionFactory, session -> { this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> {
List<Parent> list = session.byMultipleIds( Parent.class ).multiLoad( ids(56) ); List<Parent> list = session.byMultipleIds( Parent.class ).multiLoad( ids(56) );

View File

@ -5,6 +5,8 @@
* 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>.
*/ */
import org.gradle.plugins.ide.eclipse.model.ProjectDependency
apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply from: rootProject.file( 'gradle/published-java-module.gradle' )
description = 'Support for testing Hibernate ORM functionality' description = 'Support for testing Hibernate ORM functionality'
@ -43,6 +45,37 @@ sourceSets.test.resources {
setSrcDirs( ['src/test/java'] ) setSrcDirs( ['src/test/java'] )
} }
tasks.eclipse.dependsOn(cleanEclipse)
eclipse {
classpath {
file {
whenMerged { classpath ->
Set exclusionSourceSet = [
//May be a saide efect of 'gradlew_process_test_resources' on hibernate-core.gradle. It will be?!
'/org.eclipse.ui.externaltools.ExternalToolBuilder'
]
List newSourceSet = []
classpath.entries.each { item ->
if( !exclusionSourceSet.contains( item.path ) ) {
//println( 'INCLUDING: ' + item )
newSourceSet.add( item )
} else {
//println( 'NOT INCLUDING: ' + item )
}
}
println( 'newSourceSet:' )
println( newSourceSet )
def hibernateCore = new ProjectDependency('/hibernate-core')
newSourceSet += [
hibernateCore
]
classpath.entries = newSourceSet
}
}
}
}
// todo : Fold into hibernate-core and publish in separate publications // todo : Fold into hibernate-core and publish in separate publications
// once http://issues.gradle.org/browse/GRADLE-2966 is resolved; // once http://issues.gradle.org/browse/GRADLE-2966 is resolved;
// that will allow us to keep the same artifactId and publish the pom // that will allow us to keep the same artifactId and publish the pom