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,
Loadable persister,
String suffix) {
this.suffix = suffix.intern();
this.userProvidedAliases = userProvidedAliases;
this( userProvidedAliases, persister, suffix, false );
}
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 );
suffixedPropertyColumns = determinePropertyAliases( persister );
suffixedDiscriminatorColumn = determineDiscriminatorAlias( persister, suffix );
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) {