HHH-4649 Properly bind Environment#GLOBALLY_QUOTED_IDENTIFIERS to orm.xml <delimited-identifier/>
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@18159 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
6b9e796074
commit
8eb02db44c
|
@ -288,6 +288,12 @@ public class AnnotationConfiguration extends Configuration {
|
||||||
|
|
||||||
//process default values first
|
//process default values first
|
||||||
if ( !isDefaultProcessed ) {
|
if ( !isDefaultProcessed ) {
|
||||||
|
//use global delimiters if orm.xml declare it
|
||||||
|
final Object isDelimited = reflectionManager.getDefaults().get( "delimited-identifier" );
|
||||||
|
if (isDelimited != null && isDelimited == Boolean.TRUE) {
|
||||||
|
getProperties().put( Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true" );
|
||||||
|
}
|
||||||
|
|
||||||
AnnotationBinder.bindDefaults( createExtendedMappings() );
|
AnnotationBinder.bindDefaults( createExtendedMappings() );
|
||||||
isDefaultProcessed = true;
|
isDefaultProcessed = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ public class JPAMetadataProvider implements MetadataProvider {
|
||||||
if ( defaults == null ) {
|
if ( defaults == null ) {
|
||||||
defaults = new HashMap<Object, Object>();
|
defaults = new HashMap<Object, Object>();
|
||||||
XMLContext.Default xmlDefaults = xmlContext.getDefault( null );
|
XMLContext.Default xmlDefaults = xmlContext.getDefault( null );
|
||||||
|
|
||||||
|
defaults.put( "delimited-identifier", xmlDefaults.getDelimitedIdentifier() );
|
||||||
List<Class> entityListeners = new ArrayList<Class>();
|
List<Class> entityListeners = new ArrayList<Class>();
|
||||||
for ( String className : xmlContext.getDefaultEntityListeners() ) {
|
for ( String className : xmlContext.getDefaultEntityListeners() ) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -73,6 +73,8 @@ public class XMLContext {
|
||||||
globalDefaults.setAccess( unitElement != null ? unitElement.getTextTrim() : null );
|
globalDefaults.setAccess( unitElement != null ? unitElement.getTextTrim() : null );
|
||||||
unitElement = defaultElement.element( "cascade-persist" );
|
unitElement = defaultElement.element( "cascade-persist" );
|
||||||
globalDefaults.setCascadePersist( unitElement != null ? Boolean.TRUE : null );
|
globalDefaults.setCascadePersist( unitElement != null ? Boolean.TRUE : null );
|
||||||
|
unitElement = defaultElement.element( "delimited-identifiers" );
|
||||||
|
globalDefaults.setDelimitedIdentifiers( unitElement != null ? Boolean.TRUE : null );
|
||||||
defaultEntityListeners.addAll( addEntityListenerClasses( defaultElement, null, addedClasses ) );
|
defaultEntityListeners.addAll( addEntityListenerClasses( defaultElement, null, addedClasses ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -198,6 +200,7 @@ public class XMLContext {
|
||||||
private String catalog;
|
private String catalog;
|
||||||
private Boolean metadataComplete;
|
private Boolean metadataComplete;
|
||||||
private Boolean cascadePersist;
|
private Boolean cascadePersist;
|
||||||
|
private Boolean delimitedIdentifier;
|
||||||
|
|
||||||
public String getAccess() {
|
public String getAccess() {
|
||||||
return access;
|
return access;
|
||||||
|
@ -262,6 +265,7 @@ public class XMLContext {
|
||||||
if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName();
|
if ( globalDefault.getPackageName() != null ) packageName = globalDefault.getPackageName();
|
||||||
if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema();
|
if ( globalDefault.getSchema() != null ) schema = globalDefault.getSchema();
|
||||||
if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog();
|
if ( globalDefault.getCatalog() != null ) catalog = globalDefault.getCatalog();
|
||||||
|
if ( globalDefault.getDelimitedIdentifier() != null ) delimitedIdentifier = globalDefault.getDelimitedIdentifier();
|
||||||
if ( globalDefault.getMetadataComplete() != null ) {
|
if ( globalDefault.getMetadataComplete() != null ) {
|
||||||
metadataComplete = globalDefault.getMetadataComplete();
|
metadataComplete = globalDefault.getMetadataComplete();
|
||||||
}
|
}
|
||||||
|
@ -269,6 +273,14 @@ public class XMLContext {
|
||||||
if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist();
|
if ( globalDefault.getCascadePersist() != null ) cascadePersist = globalDefault.getCascadePersist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setDelimitedIdentifiers(Boolean delimitedIdentifier) {
|
||||||
|
this.delimitedIdentifier = delimitedIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getDelimitedIdentifier() {
|
||||||
|
return delimitedIdentifier;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getDefaultEntityListeners() {
|
public List<String> getDefaultEntityListeners() {
|
||||||
|
|
|
@ -2803,6 +2803,8 @@ public class Configuration implements Serializable {
|
||||||
|
|
||||||
final class ObjectNameNormalizerImpl extends ObjectNameNormalizer implements Serializable {
|
final class ObjectNameNormalizerImpl extends ObjectNameNormalizer implements Serializable {
|
||||||
public boolean isUseQuotedIdentifiersGlobally() {
|
public boolean isUseQuotedIdentifiersGlobally() {
|
||||||
|
//Do not cache this value as we lazily set it in Hibernate Annotation (AnnotationConfiguration)
|
||||||
|
//TODO use a dedicated protected useQuotedIdentifier flag in Configuration (overriden by AnnotationConfiguration)
|
||||||
String setting = (String) properties.get( Environment.GLOBALLY_QUOTED_IDENTIFIERS );
|
String setting = (String) properties.get( Environment.GLOBALLY_QUOTED_IDENTIFIERS );
|
||||||
return setting != null && Boolean.valueOf( setting ).booleanValue();
|
return setting != null && Boolean.valueOf( setting ).booleanValue();
|
||||||
}
|
}
|
||||||
|
|
|
@ -188,9 +188,6 @@ public class Ejb3Configuration implements Serializable, Referenceable {
|
||||||
this.setProperty( Environment.DATASOURCE, metadata.getNonJtaDatasource() );
|
this.setProperty( Environment.DATASOURCE, metadata.getNonJtaDatasource() );
|
||||||
}
|
}
|
||||||
defineTransactionType( metadata.getTransactionType(), workingVars );
|
defineTransactionType( metadata.getTransactionType(), workingVars );
|
||||||
if ( metadata.isUseQuotedIdentifiers() ) {
|
|
||||||
this.setProperty( Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true" );
|
|
||||||
}
|
|
||||||
if ( metadata.getClasses().size() > 0 ) {
|
if ( metadata.getClasses().size() > 0 ) {
|
||||||
workingVars.put( HibernatePersistence.CLASS_NAMES, metadata.getClasses() );
|
workingVars.put( HibernatePersistence.CLASS_NAMES, metadata.getClasses() );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue