HHH-13591 Fixing formatting of previous patch
This commit is contained in:
parent
19ac013eeb
commit
4661efa468
|
@ -20,10 +20,10 @@ import org.hibernate.bytecode.enhance.internal.tracker.SimpleFieldTracker;
|
|||
import org.hibernate.bytecode.enhance.spi.CollectionTracker;
|
||||
import org.hibernate.bytecode.enhance.spi.EnhancerConstants;
|
||||
import org.hibernate.bytecode.enhance.spi.interceptor.LazyAttributeLoadingInterceptor;
|
||||
import org.hibernate.engine.spi.ExtendedSelfDirtinessTracker;
|
||||
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
|
||||
import org.hibernate.engine.spi.CompositeOwner;
|
||||
import org.hibernate.engine.spi.CompositeTracker;
|
||||
import org.hibernate.engine.spi.ExtendedSelfDirtinessTracker;
|
||||
import org.hibernate.engine.spi.PersistentAttributeInterceptor;
|
||||
|
||||
import net.bytebuddy.asm.Advice;
|
||||
|
||||
|
@ -358,9 +358,9 @@ class CodeTemplates {
|
|||
static void enter(@FieldValue Collection<?> field, @Advice.Argument(0) Collection<?> argument, @MappedBy String mappedBy) {
|
||||
if ( field != null && Hibernate.isPropertyInitialized( field, mappedBy ) ) {
|
||||
Object[] array = field.toArray();
|
||||
for (Object array1 : array) {
|
||||
if (argument == null || !argument.contains(array1)) {
|
||||
setterNull(array1, null);
|
||||
for ( Object array1 : array ) {
|
||||
if ( argument == null || !argument.contains( array1 ) ) {
|
||||
setterNull( array1, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -370,9 +370,9 @@ class CodeTemplates {
|
|||
static void exit(@Advice.This Object self, @Advice.Argument(0) Collection<?> argument, @MappedBy String mappedBy) {
|
||||
if ( argument != null && Hibernate.isPropertyInitialized( argument, mappedBy ) ) {
|
||||
Object[] array = argument.toArray();
|
||||
for (Object array1 : array) {
|
||||
if (Hibernate.isPropertyInitialized(array1, mappedBy) && getter(array1) != self) {
|
||||
setterSelf(array1, self);
|
||||
for ( Object array1 : array ) {
|
||||
if ( Hibernate.isPropertyInitialized( array1, mappedBy ) && getter( array1 ) != self ) {
|
||||
setterSelf( array1, self );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -399,9 +399,9 @@ class CodeTemplates {
|
|||
static void enter(@FieldValue Map<?, ?> field, @Advice.Argument(0) Map<?, ?> argument, @MappedBy String mappedBy) {
|
||||
if ( field != null && Hibernate.isPropertyInitialized( field, mappedBy ) ) {
|
||||
Object[] array = field.values().toArray();
|
||||
for (Object array1 : array) {
|
||||
if (argument == null || !argument.values().contains(array1)) {
|
||||
setterNull(array1, null);
|
||||
for ( Object array1 : array ) {
|
||||
if ( argument == null || !argument.values().contains( array1 ) ) {
|
||||
setterNull( array1, null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -411,9 +411,9 @@ class CodeTemplates {
|
|||
static void exit(@Advice.This Object self, @Advice.Argument(0) Map<?, ?> argument, @MappedBy String mappedBy) {
|
||||
if ( argument != null && Hibernate.isPropertyInitialized( argument, mappedBy ) ) {
|
||||
Object[] array = argument.values().toArray();
|
||||
for (Object array1 : array) {
|
||||
if (Hibernate.isPropertyInitialized(array1, mappedBy) && getter(array1) != self) {
|
||||
setterSelf(array1, self);
|
||||
for ( Object array1 : array ) {
|
||||
if ( Hibernate.isPropertyInitialized( array1, mappedBy ) && getter( array1 ) != self ) {
|
||||
setterSelf( array1, self );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -467,9 +467,9 @@ class CodeTemplates {
|
|||
static void enter(@Advice.This Object self, @FieldValue Collection<?> field, @Advice.Argument(0) Collection<?> argument, @MappedBy String mappedBy) {
|
||||
if ( field != null && Hibernate.isPropertyInitialized( field, mappedBy ) ) {
|
||||
Object[] array = field.toArray();
|
||||
for (Object array1 : array) {
|
||||
if (argument == null || !argument.contains(array1)) {
|
||||
getter(array1).remove(self);
|
||||
for ( Object array1 : array ) {
|
||||
if ( argument == null || !argument.contains( array1 ) ) {
|
||||
getter( array1 ).remove( self );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -479,9 +479,9 @@ class CodeTemplates {
|
|||
static void exit(@Advice.This Object self, @Advice.Argument(0) Collection<?> argument, @MappedBy String mappedBy) {
|
||||
if ( argument != null && Hibernate.isPropertyInitialized( argument, mappedBy ) ) {
|
||||
Object[] array = argument.toArray();
|
||||
for (Object array1 : array) {
|
||||
if (Hibernate.isPropertyInitialized(array1, mappedBy)) {
|
||||
Collection<Object> c = getter(array1);
|
||||
for ( Object array1 : array ) {
|
||||
if ( Hibernate.isPropertyInitialized( array1, mappedBy ) ) {
|
||||
Collection<Object> c = getter( array1 );
|
||||
if ( c != self && c != null ) {
|
||||
c.add( self );
|
||||
}
|
||||
|
|
|
@ -1124,9 +1124,9 @@ public class BinderHelper {
|
|||
|
||||
public static Map<String,String> toAliasTableMap(SqlFragmentAlias[] aliases){
|
||||
Map<String,String> ret = new HashMap<>();
|
||||
for (SqlFragmentAlias aliase : aliases) {
|
||||
if (StringHelper.isNotEmpty(aliase.table())) {
|
||||
ret.put(aliase.alias(), aliase.table());
|
||||
for ( SqlFragmentAlias aliase : aliases ) {
|
||||
if ( StringHelper.isNotEmpty( aliase.table() ) ) {
|
||||
ret.put( aliase.alias(), aliase.table() );
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -1134,9 +1134,9 @@ public class BinderHelper {
|
|||
|
||||
public static Map<String,String> toAliasEntityMap(SqlFragmentAlias[] aliases){
|
||||
Map<String,String> ret = new HashMap<>();
|
||||
for (SqlFragmentAlias aliase : aliases) {
|
||||
if (aliase.entity() != void.class) {
|
||||
ret.put(aliase.alias(), aliase.entity().getName());
|
||||
for ( SqlFragmentAlias aliase : aliases ) {
|
||||
if ( aliase.entity() != void.class ) {
|
||||
ret.put( aliase.alias(), aliase.entity().getName() );
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
|
|
@ -247,8 +247,8 @@ public abstract class ExternalSessionFactoryConfig {
|
|||
|
||||
|
||||
String[] mappingFiles = ConfigurationHelper.toStringArray( mapResources, " ,\n\t\r\f" );
|
||||
for (String mappingFile : mappingFiles) {
|
||||
cfg.addResource(mappingFile);
|
||||
for ( String mappingFile : mappingFiles ) {
|
||||
cfg.addResource( mappingFile );
|
||||
}
|
||||
|
||||
return cfg;
|
||||
|
|
|
@ -66,8 +66,8 @@ public class IndexOrUniqueKeySecondPass implements SecondPass {
|
|||
@Override
|
||||
public void doSecondPass(Map persistentClasses) throws MappingException {
|
||||
if ( columns != null ) {
|
||||
for (String column1 : columns) {
|
||||
addConstraintToColumn(column1);
|
||||
for ( String column1 : columns ) {
|
||||
addConstraintToColumn( column1 );
|
||||
}
|
||||
}
|
||||
if ( column != null ) {
|
||||
|
|
|
@ -163,8 +163,8 @@ public class HQLQueryPlan implements Serializable {
|
|||
*/
|
||||
public String[] getSqlStrings() {
|
||||
List<String> sqlStrings = new ArrayList<>();
|
||||
for (QueryTranslator translator : translators) {
|
||||
sqlStrings.addAll(translator.collectSqlStrings());
|
||||
for ( QueryTranslator translator : translators ) {
|
||||
sqlStrings.addAll( translator.collectSqlStrings() );
|
||||
}
|
||||
return ArrayHelper.toStringArray( sqlStrings );
|
||||
}
|
||||
|
|
|
@ -236,7 +236,7 @@ public class NamedSQLQueryDefinition extends NamedQueryDefinition {
|
|||
allQueryReturns[i] = this.queryReturns[i];
|
||||
}
|
||||
|
||||
for (NativeSQLQueryReturn queryReturnsToAdd1 : queryReturnsToAdd) {
|
||||
for ( NativeSQLQueryReturn queryReturnsToAdd1 : queryReturnsToAdd ) {
|
||||
allQueryReturns[i] = queryReturnsToAdd1;
|
||||
i++;
|
||||
}
|
||||
|
|
|
@ -343,10 +343,10 @@ public class FromElement extends HqlSqlWalkerNode implements DisplayableNode, Pa
|
|||
final String[] propertyNames = getIdentifierPropertyNames();
|
||||
List<String> columns = new ArrayList<>();
|
||||
final boolean inSelect = getWalker().getStatementType() == HqlSqlTokenTypes.SELECT;
|
||||
for (String propertyName : propertyNames) {
|
||||
String[] propertyNameColumns = toColumns(table, propertyName, inSelect);
|
||||
for (String propertyNameColumn : propertyNameColumns) {
|
||||
columns.add(propertyNameColumn);
|
||||
for ( String propertyName : propertyNames ) {
|
||||
String[] propertyNameColumns = toColumns( table, propertyName, inSelect );
|
||||
for ( String propertyNameColumn : propertyNameColumns ) {
|
||||
columns.add( propertyNameColumn );
|
||||
}
|
||||
}
|
||||
return columns.toArray( new String[columns.size()] );
|
||||
|
|
|
@ -161,8 +161,8 @@ public class IntoClause extends HqlSqlWalkerNode implements DisplayableNode {
|
|||
if ( componentIds == null ) {
|
||||
String[] propertyNames = ( (CompositeType) persister.getIdentifierType() ).getPropertyNames();
|
||||
componentIds = new HashSet();
|
||||
for (String propertyName : propertyNames) {
|
||||
componentIds.add(propertyName);
|
||||
for ( String propertyName : propertyNames ) {
|
||||
componentIds.add( propertyName );
|
||||
}
|
||||
}
|
||||
if ( componentIds.contains( name ) ) {
|
||||
|
@ -194,7 +194,7 @@ public class IntoClause extends HqlSqlWalkerNode implements DisplayableNode {
|
|||
}
|
||||
|
||||
private void renderColumns(String[] columnNames) {
|
||||
for (String columnName : columnNames) {
|
||||
for ( String columnName : columnNames ) {
|
||||
columnSpec += columnName + ", ";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,9 @@ public class TableBasedUpdateHandlerImpl
|
|||
ps = session.getJdbcCoordinator().getStatementPreparer().prepareStatement( updates[i], false );
|
||||
if ( assignmentParameterSpecifications[i] != null ) {
|
||||
int position = 1; // jdbc params are 1-based
|
||||
for (ParameterSpecification assignmentParameterSpecification : assignmentParameterSpecifications[i]) {
|
||||
position += assignmentParameterSpecification.bind(ps, queryParameters, session, position);
|
||||
for ( ParameterSpecification assignmentParameterSpecification : assignmentParameterSpecifications[i] ) {
|
||||
position += assignmentParameterSpecification
|
||||
.bind( ps, queryParameters, session, position );
|
||||
}
|
||||
handleAddedParametersOnUpdate( ps, session, position );
|
||||
}
|
||||
|
|
|
@ -112,8 +112,9 @@ public class CteValuesListUpdateHandlerImpl
|
|||
}
|
||||
}
|
||||
if ( assignmentParameterSpecifications[i] != null ) {
|
||||
for (ParameterSpecification assignmentParameterSpecification : assignmentParameterSpecifications[i]) {
|
||||
position += assignmentParameterSpecification.bind(ps, queryParameters, session, position);
|
||||
for ( ParameterSpecification assignmentParameterSpecification : assignmentParameterSpecifications[i] ) {
|
||||
position += assignmentParameterSpecification
|
||||
.bind( ps, queryParameters, session, position );
|
||||
}
|
||||
}
|
||||
session
|
||||
|
|
|
@ -103,8 +103,9 @@ public abstract class AbstractInlineIdsUpdateHandlerImpl
|
|||
.prepareStatement( update, false )) {
|
||||
int position = 1; // jdbc params are 1-based
|
||||
if ( assignmentParameterSpecifications[i] != null ) {
|
||||
for (ParameterSpecification assignmentParameterSpecification : assignmentParameterSpecifications[i]) {
|
||||
position += assignmentParameterSpecification.bind(ps, queryParameters, session, position);
|
||||
for ( ParameterSpecification assignmentParameterSpecification : assignmentParameterSpecifications[i] ) {
|
||||
position += assignmentParameterSpecification
|
||||
.bind( ps, queryParameters, session, position );
|
||||
}
|
||||
}
|
||||
jdbcCoordinator.getResultSetReturn()
|
||||
|
|
|
@ -5264,8 +5264,8 @@ public abstract class AbstractEntityPersister
|
|||
if ( attribute.getType() instanceof ComponentType ) {
|
||||
final ComponentType type = (ComponentType) attribute.getType();
|
||||
final ValueGeneration[] propertyValueGenerationStrategies = type.getPropertyValueGenerationStrategies();
|
||||
for (ValueGeneration propertyValueGenerationStrategie : propertyValueGenerationStrategies) {
|
||||
if (isReadRequired(propertyValueGenerationStrategie, matchTiming)) {
|
||||
for ( ValueGeneration propertyValueGenerationStrategie : propertyValueGenerationStrategies ) {
|
||||
if ( isReadRequired( propertyValueGenerationStrategie, matchTiming ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,12 +38,12 @@ public class Insert {
|
|||
}
|
||||
|
||||
public Insert addColumn(String columnName) {
|
||||
return addColumn(columnName, "?");
|
||||
return addColumn( columnName, "?" );
|
||||
}
|
||||
|
||||
public Insert addColumns(String[] columnNames) {
|
||||
for (String columnName : columnNames) {
|
||||
addColumn(columnName);
|
||||
for ( String columnName : columnNames ) {
|
||||
addColumn( columnName );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
@ -67,12 +67,12 @@ public class Insert {
|
|||
}
|
||||
|
||||
public Insert addColumn(String columnName, String valueExpression) {
|
||||
columns.put(columnName, valueExpression);
|
||||
columns.put( columnName, valueExpression );
|
||||
return this;
|
||||
}
|
||||
|
||||
public Insert addColumn(String columnName, Object value, LiteralType type) throws Exception {
|
||||
return addColumn( columnName, type.objectToSQLString(value, dialect) );
|
||||
return addColumn( columnName, type.objectToSQLString( value, dialect ) );
|
||||
}
|
||||
|
||||
public Insert addIdentityColumn(String columnName) {
|
||||
|
|
|
@ -44,8 +44,8 @@ public class InsertSelect {
|
|||
}
|
||||
|
||||
public InsertSelect addColumns(String[] columnNames) {
|
||||
for (String columnName : columnNames) {
|
||||
this.columnNames.add(columnName);
|
||||
for ( String columnName : columnNames ) {
|
||||
this.columnNames.add( columnName );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -88,10 +88,12 @@ public class QueryJoinFragment extends JoinFragment {
|
|||
}
|
||||
|
||||
public void addCondition(String alias, String[] columns, String condition) {
|
||||
for (String column : columns) {
|
||||
for ( String column : columns ) {
|
||||
afterWhere.append( " and " )
|
||||
.append( alias )
|
||||
.append( '.' ).append(column).append(condition);
|
||||
.append( alias )
|
||||
.append( '.' )
|
||||
.append( column )
|
||||
.append( condition );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -530,8 +530,8 @@ public class InformationExtractorJdbcDatabaseMetaDataImpl implements Information
|
|||
if ( "TABLE".equalsIgnoreCase( tableType ) ) {
|
||||
return true;
|
||||
}
|
||||
for (String extraPhysicalTableType : extraPhysicalTableTypes) {
|
||||
if (extraPhysicalTableType.equalsIgnoreCase(tableType)) {
|
||||
for ( String extraPhysicalTableType : extraPhysicalTableTypes ) {
|
||||
if ( extraPhysicalTableType.equalsIgnoreCase( tableType ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -832,8 +832,8 @@ public class EntityMetamodel implements Serializable {
|
|||
}
|
||||
else if ( type.isComponentType() ) {
|
||||
Type[] subtypes = ( (CompositeType) type ).getSubtypes();
|
||||
for (Type subtype : subtypes) {
|
||||
if (indicatesCollection(subtype)) {
|
||||
for ( Type subtype : subtypes ) {
|
||||
if ( indicatesCollection( subtype ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,11 +8,6 @@
|
|||
//$Id: FumTest.java 10977 2006-12-12 23:28:04Z steve.ebersole@jboss.com $
|
||||
package org.hibernate.test.legacy;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
|
@ -21,7 +16,6 @@ import java.io.ObjectOutputStream;
|
|||
import java.io.Serializable;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -51,18 +45,22 @@ import org.hibernate.dialect.MySQLDialect;
|
|||
import org.hibernate.dialect.PointbaseDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
import org.hibernate.dialect.TimesTenDialect;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.transform.Transformers;
|
||||
import org.hibernate.type.CalendarType;
|
||||
import org.hibernate.type.EntityType;
|
||||
import org.hibernate.type.StandardBasicTypes;
|
||||
import org.hibernate.type.StringType;
|
||||
import org.hibernate.type.Type;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@RequiresDialectFeature(DialectChecks.SupportsNoColumnInsert.class)
|
||||
public class FumTest extends LegacyTestCase {
|
||||
private static short fumKeyShort = 1;
|
||||
|
@ -470,13 +468,13 @@ public class FumTest extends LegacyTestCase {
|
|||
);
|
||||
Query qu = s.createQuery("select fum.fum, fum , fum.fum from Fum fum");
|
||||
Type[] types = qu.getReturnTypes();
|
||||
assertTrue(types.length==3);
|
||||
for (Type type : types) {
|
||||
assertTrue(type != null);
|
||||
assertTrue( types.length == 3 );
|
||||
for ( Type type : types ) {
|
||||
assertTrue( type != null );
|
||||
}
|
||||
assertTrue(types[0] instanceof StringType);
|
||||
assertTrue(types[1] instanceof EntityType);
|
||||
assertTrue(types[2] instanceof StringType);
|
||||
assertTrue( types[0] instanceof StringType );
|
||||
assertTrue( types[1] instanceof EntityType );
|
||||
assertTrue( types[2] instanceof StringType );
|
||||
Iterator iter = qu.iterate();
|
||||
int j = 0;
|
||||
while ( iter.hasNext() ) {
|
||||
|
|
|
@ -6,16 +6,14 @@
|
|||
*/
|
||||
package org.hibernate.test.schemaupdate;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import org.hibernate.annotations.ForeignKey;
|
||||
import org.hibernate.boot.MetadataSources;
|
||||
|
@ -23,9 +21,10 @@ import org.hibernate.boot.registry.StandardServiceRegistry;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.tool.schema.internal.SchemaCreatorImpl;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
@ -57,8 +56,8 @@ public class ImplicitCompositeKeyJoinTest {
|
|||
if ( command.toLowerCase().matches( "^create( (column|row))? table employee.+" ) ) {
|
||||
final String[] columnsDefinition = getColumnsDefinition( command );
|
||||
|
||||
for (String columnsDefinition1 : columnsDefinition) {
|
||||
checkColumnSize(columnsDefinition1);
|
||||
for ( String columnsDefinition1 : columnsDefinition ) {
|
||||
checkColumnSize( columnsDefinition1 );
|
||||
}
|
||||
createTableEmployeeFound = true;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,6 @@ import javax.persistence.ManyToOne;
|
|||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.Hibernate;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.Transaction;
|
||||
|
@ -45,8 +43,10 @@ import org.hibernate.annotations.Fetch;
|
|||
import org.hibernate.annotations.FetchMode;
|
||||
import org.hibernate.cfg.Configuration;
|
||||
import org.hibernate.cfg.Environment;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
@ -102,22 +102,22 @@ public class SubselectFetchCollectionFromBatchTest extends BaseCoreFunctionalTe
|
|||
assertEquals( 0, sessionFactory().getStatistics().getPrepareStatementCount() );
|
||||
|
||||
|
||||
for (EmployeeGroup group : groups) {
|
||||
for ( EmployeeGroup group : groups ) {
|
||||
// Both groups get initialized and are added to the PersistenceContext when i == 0;
|
||||
// Still need to call Hibernate.initialize( groups[i] ) for i > 0 so that the entity
|
||||
// in the PersistenceContext gets assigned to its respective proxy target (is this a
|
||||
// bug???)
|
||||
Hibernate.initialize(group);
|
||||
assertTrue(Hibernate.isInitialized(group));
|
||||
Hibernate.initialize( group );
|
||||
assertTrue( Hibernate.isInitialized( group ) );
|
||||
// the collections should be uninitialized
|
||||
assertFalse(Hibernate.isInitialized(group.getEmployees()));
|
||||
assertFalse( Hibernate.isInitialized( group.getEmployees() ) );
|
||||
}
|
||||
|
||||
// both Group proxies should have been loaded in the same batch;
|
||||
assertEquals( 1, sessionFactory().getStatistics().getPrepareStatementCount() );
|
||||
sessionFactory().getStatistics().clear();
|
||||
|
||||
for (EmployeeGroup group : groups) {
|
||||
for ( EmployeeGroup group : groups ) {
|
||||
assertTrue( Hibernate.isInitialized( group ) );
|
||||
assertFalse( Hibernate.isInitialized( group.getEmployees() ) );
|
||||
}
|
||||
|
@ -250,26 +250,26 @@ public class SubselectFetchCollectionFromBatchTest extends BaseCoreFunctionalTe
|
|||
assertEquals( 0, sessionFactory().getStatistics().getPrepareStatementCount() );
|
||||
|
||||
|
||||
for (EmployeeGroup group : groups) {
|
||||
for ( EmployeeGroup group : groups ) {
|
||||
// Both groups get initialized and are added to the PersistenceContext when i == 0;
|
||||
// Still need to call Hibernate.initialize( groups[i] ) for i > 0 so that the entity
|
||||
// in the PersistenceContext gets assigned to its respective proxy target (is this a
|
||||
// bug???)
|
||||
Hibernate.initialize(group);
|
||||
assertTrue(Hibernate.isInitialized(group));
|
||||
assertTrue(Hibernate.isInitialized(group.getLead()));
|
||||
assertFalse(Hibernate.isInitialized(group.getLead().getCollaborators()));
|
||||
assertTrue(Hibernate.isInitialized(group.getManager()));
|
||||
assertFalse(Hibernate.isInitialized(group.getManager().getCollaborators()));
|
||||
Hibernate.initialize( group );
|
||||
assertTrue( Hibernate.isInitialized( group ) );
|
||||
assertTrue( Hibernate.isInitialized( group.getLead() ) );
|
||||
assertFalse( Hibernate.isInitialized( group.getLead().getCollaborators() ) );
|
||||
assertTrue( Hibernate.isInitialized( group.getManager() ) );
|
||||
assertFalse( Hibernate.isInitialized( group.getManager().getCollaborators() ) );
|
||||
// the collections should be uninitialized
|
||||
assertFalse(Hibernate.isInitialized(group.getEmployees()));
|
||||
assertFalse( Hibernate.isInitialized( group.getEmployees() ) );
|
||||
}
|
||||
|
||||
// both Group proxies should have been loaded in the same batch;
|
||||
assertEquals( 1, sessionFactory().getStatistics().getPrepareStatementCount() );
|
||||
sessionFactory().getStatistics().clear();
|
||||
|
||||
for (EmployeeGroup group : groups) {
|
||||
for ( EmployeeGroup group : groups ) {
|
||||
assertTrue( Hibernate.isInitialized( group ) );
|
||||
assertFalse( Hibernate.isInitialized( group.getEmployees() ) );
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ public final class ExtraAssertions {
|
|||
private static Map generateJdbcTypeCache() {
|
||||
final Field[] fields = Types.class.getFields();
|
||||
Map cache = new HashMap( (int)( fields.length * .75 ) + 1 );
|
||||
for (Field field : fields) {
|
||||
for ( Field field : fields ) {
|
||||
if ( Modifier.isStatic( field.getModifiers() ) ) {
|
||||
try {
|
||||
cache.put( field.get( null ), field.getName() );
|
||||
|
|
Loading…
Reference in New Issue