HHH-6068 - Honor JPA default schema and catalog
This commit is contained in:
parent
e14e47968f
commit
2ac8c0c007
|
@ -1306,10 +1306,21 @@ public class Configuration implements Serializable {
|
|||
{
|
||||
if ( !isDefaultProcessed ) {
|
||||
//use global delimiters if orm.xml declare it
|
||||
final Object isDelimited = reflectionManager.getDefaults().get( "delimited-identifier" );
|
||||
Map defaults = reflectionManager.getDefaults();
|
||||
final Object isDelimited = defaults.get( "delimited-identifier" );
|
||||
if ( isDelimited != null && isDelimited == Boolean.TRUE ) {
|
||||
getProperties().put( Environment.GLOBALLY_QUOTED_IDENTIFIERS, "true" );
|
||||
}
|
||||
// Set default schema name if orm.xml declares it.
|
||||
final String schema = (String) defaults.get( "schema" );
|
||||
if ( StringHelper.isNotEmpty( schema ) ) {
|
||||
getProperties().put( Environment.DEFAULT_SCHEMA, schema );
|
||||
}
|
||||
// Set default catalog name if orm.xml declares it.
|
||||
final String catalog = (String) defaults.get( "catalog" );
|
||||
if ( StringHelper.isNotEmpty( catalog ) ) {
|
||||
getProperties().put( Environment.DEFAULT_CATALOG, catalog );
|
||||
}
|
||||
|
||||
AnnotationBinder.bindDefaults( createMappings() );
|
||||
isDefaultProcessed = true;
|
||||
|
|
|
@ -80,6 +80,8 @@ public class JPAMetadataProvider implements MetadataProvider, Serializable {
|
|||
defaults = new HashMap<Object, Object>();
|
||||
XMLContext.Default xmlDefaults = xmlContext.getDefault( null );
|
||||
|
||||
defaults.put( "schema", xmlDefaults.getSchema() );
|
||||
defaults.put( "catalog", xmlDefaults.getCatalog() );
|
||||
defaults.put( "delimited-identifier", xmlDefaults.getDelimitedIdentifier() );
|
||||
List<Class> entityListeners = new ArrayList<Class>();
|
||||
for ( String className : xmlContext.getDefaultEntityListeners() ) {
|
||||
|
|
Loading…
Reference in New Issue