HHH-6416 : Move AuxiliaryDatabaseObject into Database
This commit is contained in:
parent
d58bb5a103
commit
30843f2032
|
@ -23,7 +23,9 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.relational;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -33,6 +35,7 @@ import java.util.Map;
|
|||
*/
|
||||
public class Database {
|
||||
private Map<Schema.Name,Schema> schemaMap = new HashMap<Schema.Name, Schema>();
|
||||
private final List<AuxiliaryDatabaseObject> auxiliaryDatabaseObjects = new ArrayList<AuxiliaryDatabaseObject>();
|
||||
|
||||
public Schema getSchema(Schema.Name name) {
|
||||
Schema schema = schemaMap.get( name );
|
||||
|
@ -50,4 +53,15 @@ public class Database {
|
|||
public Schema getSchema(String schema, String catalog) {
|
||||
return getSchema( new Schema.Name( Identifier.toIdentifier( schema ), Identifier.toIdentifier( catalog ) ) );
|
||||
}
|
||||
|
||||
public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) {
|
||||
if ( auxiliaryDatabaseObject == null ) {
|
||||
throw new IllegalArgumentException( "Auxiliary database object is null." );
|
||||
}
|
||||
auxiliaryDatabaseObjects.add( auxiliaryDatabaseObject );
|
||||
}
|
||||
|
||||
public Iterable<AuxiliaryDatabaseObject> getAuxiliaryDatabaseObjects() {
|
||||
return auxiliaryDatabaseObjects;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,7 +192,7 @@ public class HibernateMappingProcessor implements HbmBindingContext {
|
|||
dialectScopes
|
||||
);
|
||||
}
|
||||
metadata.addAuxiliaryDatabaseObject( auxiliaryDatabaseObject );
|
||||
metadata.getDatabase().addAuxiliaryDatabaseObject( auxiliaryDatabaseObject );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,6 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections.functors.FalsePredicate;
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import org.hibernate.DuplicateMappingException;
|
||||
|
@ -53,7 +52,6 @@ import org.hibernate.metamodel.binding.IdGenerator;
|
|||
import org.hibernate.metamodel.binding.PluralAttributeBinding;
|
||||
import org.hibernate.metamodel.binding.TypeDef;
|
||||
import org.hibernate.metamodel.domain.JavaType;
|
||||
import org.hibernate.metamodel.relational.AuxiliaryDatabaseObject;
|
||||
import org.hibernate.metamodel.relational.Database;
|
||||
import org.hibernate.metamodel.source.annotations.AnnotationBinder;
|
||||
import org.hibernate.metamodel.source.hbm.HbmBinder;
|
||||
|
@ -109,8 +107,6 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
|
|||
private Map<String, ResultSetMappingDefinition> resultSetMappings = new HashMap<String, ResultSetMappingDefinition>();
|
||||
private Map<String, FilterDefinition> filterDefs = new HashMap<String, FilterDefinition>();
|
||||
|
||||
// todo : keep as part of Database?
|
||||
private List<AuxiliaryDatabaseObject> auxiliaryDatabaseObjects = new ArrayList<AuxiliaryDatabaseObject>();
|
||||
private boolean globallyQuotedIdentifiers = false;
|
||||
|
||||
public MetadataImpl(MetadataSources metadataSources, Options options) {
|
||||
|
@ -216,14 +212,6 @@ public class MetadataImpl implements MetadataImplementor, Serializable {
|
|||
identifierGeneratorFactory.register( name, classLoaderService().classForName( generatorClassName ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject) {
|
||||
if ( auxiliaryDatabaseObject == null ) {
|
||||
throw new IllegalArgumentException( "Auxiliary database object is null." );
|
||||
}
|
||||
auxiliaryDatabaseObjects.add( auxiliaryDatabaseObject );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addNamedNativeQuery(NamedSQLQueryDefinition def) {
|
||||
if ( def == null || def.getName() == null ) {
|
||||
|
|
|
@ -71,6 +71,4 @@ public interface MetadataImplementor extends Metadata, BindingContext, Mapping {
|
|||
public void addNamedQuery(NamedQueryDefinition def);
|
||||
|
||||
public void addResultSetMapping(ResultSetMappingDefinition resultSetMappingDefinition);
|
||||
|
||||
public void addAuxiliaryDatabaseObject(AuxiliaryDatabaseObject auxiliaryDatabaseObject);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue