HHH-13531 Some more opportunities to reuse the constants pool in AliasConstantsHelperMore opportunities to reuse the int_ constant pools
This commit is contained in:
parent
33532c8998
commit
343deb982f
|
@ -22,6 +22,7 @@ import org.hibernate.internal.CoreLogging;
|
|||
import org.hibernate.internal.CoreMessageLogger;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.loader.PropertyPath;
|
||||
import org.hibernate.loader.internal.AliasConstantsHelper;
|
||||
import org.hibernate.param.ParameterSpecification;
|
||||
import org.hibernate.persister.collection.CollectionPropertyMapping;
|
||||
import org.hibernate.persister.collection.CollectionPropertyNames;
|
||||
|
@ -191,7 +192,7 @@ class FromElementType {
|
|||
}
|
||||
|
||||
private static String generateSuffix(int size, int k) {
|
||||
return size == 1 ? "" : Integer.toString( k ) + '_';
|
||||
return size == 1 ? "" : AliasConstantsHelper.get( k );
|
||||
}
|
||||
|
||||
private void checkInitialized() {
|
||||
|
|
|
@ -50,6 +50,7 @@ import org.hibernate.internal.util.ReflectHelper;
|
|||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.loader.BasicLoader;
|
||||
import org.hibernate.loader.internal.AliasConstantsHelper;
|
||||
import org.hibernate.loader.spi.AfterLoadAction;
|
||||
import org.hibernate.param.CollectionFilterKeyParameterSpecification;
|
||||
import org.hibernate.param.ParameterBinder;
|
||||
|
@ -664,7 +665,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
//if ( !isName(name) ) throw new QueryException("unknown type: " + name);
|
||||
persisters[i] = getEntityPersisterForName( name );
|
||||
// TODO: cannot use generateSuffixes() - it handles the initial suffix differently.
|
||||
suffixes[i] = ( size == 1 ) ? "" : Integer.toString( i ) + '_';
|
||||
suffixes[i] = ( size == 1 ) ? "" : AliasConstantsHelper.get( i );
|
||||
names[i] = name;
|
||||
includeInSelect[i] = !entitiesToFetch.contains( name );
|
||||
if ( includeInSelect[i] ) {
|
||||
|
@ -763,7 +764,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
|
||||
for ( int k = 0; k < size; k++ ) {
|
||||
String name = (String) returnedTypes.get( k );
|
||||
String suffix = size == 1 ? "" : Integer.toString( k ) + '_';
|
||||
String suffix = size == 1 ? "" : AliasConstantsHelper.get( k );
|
||||
sql.addSelectFragmentString( persisters[k].identifierSelectFragment( name, suffix ) );
|
||||
}
|
||||
|
||||
|
@ -788,7 +789,7 @@ public class QueryTranslatorImpl extends BasicLoader implements FilterTranslator
|
|||
private void renderPropertiesSelect(QuerySelect sql) {
|
||||
int size = returnedTypes.size();
|
||||
for ( int k = 0; k < size; k++ ) {
|
||||
String suffix = size == 1 ? "" : Integer.toString( k ) + '_';
|
||||
String suffix = size == 1 ? "" : AliasConstantsHelper.get( k );
|
||||
String name = (String) returnedTypes.get( k );
|
||||
sql.addSelectFragmentString( persisters[k].propertySelectFragment( name, suffix, false ) );
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.regex.Pattern;
|
|||
import org.hibernate.boot.model.source.internal.hbm.CommaSeparatedStringHelper;
|
||||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.internal.util.collections.ArrayHelper;
|
||||
import org.hibernate.loader.internal.AliasConstantsHelper;
|
||||
|
||||
public final class StringHelper {
|
||||
|
||||
|
@ -585,8 +586,7 @@ public final class StringHelper {
|
|||
*/
|
||||
public static String generateAlias(String description, int unique) {
|
||||
return generateAliasRoot( description )
|
||||
+ Integer.toString( unique )
|
||||
+ '_';
|
||||
+ AliasConstantsHelper.get( unique );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,6 +19,7 @@ import org.hibernate.loader.CollectionAliases;
|
|||
import org.hibernate.loader.DefaultEntityAliases;
|
||||
import org.hibernate.loader.EntityAliases;
|
||||
import org.hibernate.loader.GeneratedCollectionAliases;
|
||||
import org.hibernate.loader.internal.AliasConstantsHelper;
|
||||
import org.hibernate.loader.plan.build.spi.QuerySpaceTreePrinter;
|
||||
import org.hibernate.loader.plan.build.spi.TreePrinterHelper;
|
||||
import org.hibernate.loader.plan.exec.spi.AliasResolutionContext;
|
||||
|
@ -142,7 +143,7 @@ public class AliasResolutionContextImpl implements AliasResolutionContext {
|
|||
}
|
||||
|
||||
private String createSuffix() {
|
||||
return Integer.toString( currentAliasSuffix++ ) + '_';
|
||||
return AliasConstantsHelper.get( currentAliasSuffix++ );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,7 @@ import org.hibernate.dialect.Dialect;
|
|||
import org.hibernate.dialect.function.SQLFunctionRegistry;
|
||||
import org.hibernate.engine.spi.Mapping;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.loader.internal.AliasConstantsHelper;
|
||||
import org.hibernate.sql.Template;
|
||||
|
||||
import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||
|
@ -110,7 +111,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
@Override
|
||||
public String getAlias(Dialect dialect) {
|
||||
final int lastLetter = StringHelper.lastIndexOfLetter( name );
|
||||
final String suffix = Integer.toString( uniqueInteger ) + '_';
|
||||
final String suffix = AliasConstantsHelper.get( uniqueInteger );
|
||||
|
||||
String alias = name;
|
||||
if ( lastLetter == -1 ) {
|
||||
|
@ -143,7 +144,7 @@ public class Column implements Selectable, Serializable, Cloneable {
|
|||
*/
|
||||
@Override
|
||||
public String getAlias(Dialect dialect, Table table) {
|
||||
return safeInterning( getAlias( dialect ) + table.getUniqueInteger() + '_' );
|
||||
return safeInterning( getAlias( dialect ) + AliasConstantsHelper.get( table.getUniqueInteger() ) );
|
||||
}
|
||||
|
||||
public boolean isNullable() {
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.dialect.function.SQLFunctionRegistry;
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.loader.internal.AliasConstantsHelper;
|
||||
import org.hibernate.sql.Template;
|
||||
|
||||
import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||
|
@ -54,7 +55,7 @@ public class Formula implements Selectable, Serializable {
|
|||
|
||||
@Override
|
||||
public String getAlias(Dialect dialect) {
|
||||
return "formula" + Integer.toString(uniqueInteger) + '_';
|
||||
return "formula" + AliasConstantsHelper.get( uniqueInteger );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue