mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-17 16:44:57 +00:00
HHH-12918 Interning of strings for Formula and Column exctraction templates
(cherry picked from commit 096b436f3dd1bb2b3daf16bf3e82812bebde232c)
This commit is contained in:
parent
e520fd9b99
commit
5f7b41d54b
@ -17,6 +17,8 @@
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.sql.Template;
|
||||
|
||||
import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||
|
||||
/**
|
||||
* A column of a relational database table
|
||||
*
|
||||
@ -268,10 +270,12 @@ public boolean hasCheckConstraint() {
|
||||
|
||||
@Override
|
||||
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
||||
return hasCustomRead()
|
||||
return safeInterning(
|
||||
hasCustomRead()
|
||||
// see note in renderTransformerReadFragment wrt access to SessionFactory
|
||||
? Template.renderTransformerReadFragment( customRead, getQuotedName( dialect ) )
|
||||
: Template.TEMPLATE + '.' + getQuotedName( dialect );
|
||||
: Template.TEMPLATE + '.' + getQuotedName( dialect )
|
||||
);
|
||||
}
|
||||
|
||||
public boolean hasCustomRead() {
|
||||
|
@ -13,6 +13,8 @@
|
||||
import org.hibernate.internal.util.StringHelper;
|
||||
import org.hibernate.sql.Template;
|
||||
|
||||
import static org.hibernate.internal.util.StringHelper.safeInterning;
|
||||
|
||||
/**
|
||||
* A formula is a derived column value
|
||||
* @author Gavin King
|
||||
@ -35,7 +37,7 @@ public Formula(String formula) {
|
||||
@Override
|
||||
public String getTemplate(Dialect dialect, SQLFunctionRegistry functionRegistry) {
|
||||
String template = Template.renderWhereStringTemplate(formula, dialect, functionRegistry);
|
||||
return StringHelper.replace( template, "{alias}", Template.TEMPLATE );
|
||||
return safeInterning( StringHelper.replace( template, "{alias}", Template.TEMPLATE ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user