HHH-13513 Only intern fields of DefaultEntityAliases when the object is not short lived

This commit is contained in:
Sanne Grinovero 2019-07-25 12:02:47 +01:00 committed by Andrea Boriero
parent bfe5f235c1
commit ed8c72871b
1 changed files with 20 additions and 7 deletions

View File

@ -42,18 +42,31 @@ public class DefaultEntityAliases implements EntityAliases {
Map userProvidedAliases, Map userProvidedAliases,
Loadable persister, Loadable persister,
String suffix) { String suffix) {
this.suffix = suffix.intern(); this( userProvidedAliases, persister, suffix, false );
this.userProvidedAliases = userProvidedAliases; }
public DefaultEntityAliases(Loadable persister, String suffix) {
this( Collections.EMPTY_MAP, persister, suffix, true );
}
private DefaultEntityAliases(
Map userProvidedAliases,
Loadable persister,
String suffix,
boolean interns) {
if ( interns ) {
this.suffix = suffix.intern();
this.rowIdAlias = (Loadable.ROWID_ALIAS + suffix).intern(); // TODO: not visible to the user!
}
else {
this.suffix = suffix;
this.rowIdAlias = (Loadable.ROWID_ALIAS + suffix);
}
this.userProvidedAliases = userProvidedAliases;
suffixedKeyColumns = determineKeyAlias( persister, suffix ); suffixedKeyColumns = determineKeyAlias( persister, suffix );
suffixedPropertyColumns = determinePropertyAliases( persister ); suffixedPropertyColumns = determinePropertyAliases( persister );
suffixedDiscriminatorColumn = determineDiscriminatorAlias( persister, suffix ); suffixedDiscriminatorColumn = determineDiscriminatorAlias( persister, suffix );
suffixedVersionColumn = determineVersionAlias( persister ); suffixedVersionColumn = determineVersionAlias( persister );
rowIdAlias = (Loadable.ROWID_ALIAS + suffix).intern(); // TODO: not visible to the user!
}
public DefaultEntityAliases(Loadable persister, String suffix) {
this( Collections.EMPTY_MAP, persister, suffix );
} }
private String[] determineKeyAlias(Loadable persister, String suffix) { private String[] determineKeyAlias(Loadable persister, String suffix) {