HHH-12918 Interning of strings for Formula and Column exctraction templates
This commit is contained in:
parent
4fa0491341
commit
096b436f3d
|
@ -17,6 +17,8 @@ import org.hibernate.engine.spi.Mapping;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.sql.Template;
|
import org.hibernate.sql.Template;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A column of a relational database table
|
* A column of a relational database table
|
||||||
*
|
*
|
||||||
|
@ -268,10 +270,12 @@ public class Column implements Selectable, Serializable, Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
||||||
return hasCustomRead()
|
return safeInterning(
|
||||||
|
hasCustomRead()
|
||||||
// see note in renderTransformerReadFragment wrt access to SessionFactory
|
// see note in renderTransformerReadFragment wrt access to SessionFactory
|
||||||
? Template.renderTransformerReadFragment( customRead, getQuotedName( dialect ) )
|
? Template.renderTransformerReadFragment( customRead, getQuotedName( dialect ) )
|
||||||
: Template.TEMPLATE + '.' + getQuotedName( dialect );
|
: Template.TEMPLATE + '.' + getQuotedName( dialect )
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasCustomRead() {
|
public boolean hasCustomRead() {
|
||||||
|
|
|
@ -13,6 +13,8 @@ import org.hibernate.dialect.function.SQLFunctionRegistry;
|
||||||
import org.hibernate.internal.util.StringHelper;
|
import org.hibernate.internal.util.StringHelper;
|
||||||
import org.hibernate.sql.Template;
|
import org.hibernate.sql.Template;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A formula is a derived column value
|
* A formula is a derived column value
|
||||||
* @author Gavin King
|
* @author Gavin King
|
||||||
|
@ -35,7 +37,7 @@ public class Formula implements Selectable, Serializable {
|
||||||
@Override
|
@Override
|
||||||
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
||||||
String template = Template.renderWhereStringTemplate(formula, dialect, functionRegistry);
|
String template = Template.renderWhereStringTemplate(formula, dialect, functionRegistry);
|
||||||
return StringHelper.replace( template, "{alias}", Template.TEMPLATE );
|
return safeInterning( StringHelper.replace( template, "{alias}", Template.TEMPLATE ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue