HHH-4533 move metamodel storage to Hibernate Core

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@17872 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Emmanuel Bernard 2009-10-29 00:13:24 +00:00
parent c7c6981a55
commit f795bd31e4
4 changed files with 43 additions and 20 deletions

View File

@ -135,7 +135,6 @@ public class AnnotationConfiguration extends Configuration {
private transient ReflectionManager reflectionManager; private transient ReflectionManager reflectionManager;
private boolean isDefaultProcessed = false; private boolean isDefaultProcessed = false;
private boolean isValidatorNotPresentLogged; private boolean isValidatorNotPresentLogged;
private Map<Class<?>, org.hibernate.mapping.MappedSuperclass> mappedSuperclasses;
public AnnotationConfiguration() { public AnnotationConfiguration() {
super(); super();
@ -261,7 +260,6 @@ public class AnnotationConfiguration extends Configuration {
namingStrategy = EJB3NamingStrategy.INSTANCE; namingStrategy = EJB3NamingStrategy.INSTANCE;
setEntityResolver( new EJB3DTDEntityResolver() ); setEntityResolver( new EJB3DTDEntityResolver() );
anyMetaDefs = new HashMap<String, AnyMetaDef>(); anyMetaDefs = new HashMap<String, AnyMetaDef>();
mappedSuperclasses = new HashMap<Class<?>, org.hibernate.mapping.MappedSuperclass>();
reflectionManager = new JavaReflectionManager(); reflectionManager = new JavaReflectionManager();
( ( MetadataProviderInjector ) reflectionManager ).setMetadataProvider( new JPAMetadataProvider() ); ( ( MetadataProviderInjector ) reflectionManager ).setMetadataProvider( new JPAMetadataProvider() );
@ -1180,14 +1178,6 @@ public class AnnotationConfiguration extends Configuration {
return inSecondPass; return inSecondPass;
} }
public void addMappedSuperclass(Class<?> type, org.hibernate.mapping.MappedSuperclass mappedSuperclass) {
mappedSuperclasses.put( type, mappedSuperclass );
}
public org.hibernate.mapping.MappedSuperclass getMappedSuperclass(Class<?> type) {
return mappedSuperclasses.get( type );
}
public IdGenerator getGenerator(String name) { public IdGenerator getGenerator(String name) {
return getGenerator( name, null ); return getGenerator( name, null );
} }

View File

@ -161,14 +161,4 @@ public interface ExtendedMappings extends Mappings {
public AnyMetaDef getAnyMetaDef(String name); public AnyMetaDef getAnyMetaDef(String name);
public boolean isInSecondPass(); public boolean isInSecondPass();
/**
* add a new MappedSuperclass
*/
public void addMappedSuperclass(Class<?> type, org.hibernate.mapping.MappedSuperclass mappedSuperclass);
/**
* Get a MappedSuperclass or null if not mapped
*/
org.hibernate.mapping.MappedSuperclass getMappedSuperclass(Class<?> type);
} }

View File

@ -126,6 +126,7 @@ import org.hibernate.mapping.FetchProfile;
import org.hibernate.mapping.DenormalizedTable; import org.hibernate.mapping.DenormalizedTable;
import org.hibernate.mapping.TypeDef; import org.hibernate.mapping.TypeDef;
import org.hibernate.mapping.Column; import org.hibernate.mapping.Column;
import org.hibernate.mapping.MappedSuperclass;
import org.hibernate.proxy.EntityNotFoundDelegate; import org.hibernate.proxy.EntityNotFoundDelegate;
import org.hibernate.secure.JACCConfiguration; import org.hibernate.secure.JACCConfiguration;
import org.hibernate.tool.hbm2ddl.DatabaseMetadata; import org.hibernate.tool.hbm2ddl.DatabaseMetadata;
@ -207,6 +208,9 @@ public class Configuration implements Serializable {
private DefaultIdentifierGeneratorFactory identifierGeneratorFactory; private DefaultIdentifierGeneratorFactory identifierGeneratorFactory;
//Map<Class<?>, org.hibernate.mapping.MappedSuperclass>
private Map mappedSuperclasses;
protected Configuration(SettingsFactory settingsFactory) { protected Configuration(SettingsFactory settingsFactory) {
this.settingsFactory = settingsFactory; this.settingsFactory = settingsFactory;
reset(); reset();
@ -252,6 +256,8 @@ public class Configuration implements Serializable {
// componentTuplizerFactory = new ComponentTuplizerFactory(); // componentTuplizerFactory = new ComponentTuplizerFactory();
identifierGeneratorFactory = new DefaultIdentifierGeneratorFactory(); identifierGeneratorFactory = new DefaultIdentifierGeneratorFactory();
mappedSuperclasses = new HashMap();
} }
public EntityTuplizerFactory getEntityTuplizerFactory() { public EntityTuplizerFactory getEntityTuplizerFactory() {
@ -2747,5 +2753,17 @@ public class Configuration implements Serializable {
public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory() { public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory() {
return identifierGeneratorFactory; return identifierGeneratorFactory;
} }
public void addMappedSuperclass(Class type, MappedSuperclass mappedSuperclass) {
mappedSuperclasses.put( type, mappedSuperclass );
}
public MappedSuperclass getMappedSuperclass(Class type) {
return (MappedSuperclass) mappedSuperclasses.get( type );
}
public Iterator iterateMappedSuperclasses() {
return mappedSuperclasses.values().iterator();
}
} }
} }

View File

@ -526,4 +526,29 @@ public interface Mappings {
* @return The IdentifierGeneratorFactory * @return The IdentifierGeneratorFactory
*/ */
public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory(); public DefaultIdentifierGeneratorFactory getIdentifierGeneratorFactory();
/**
* add a new MappedSuperclass
* This should not be called if the MappedSuperclass already exists
* (it would be erased)
* @param type type corresponding to the Mappedsuperclass
* @param mappedSuperclass MappedSuperclass
*/
public void addMappedSuperclass(Class type, org.hibernate.mapping.MappedSuperclass mappedSuperclass);
/**
* Get a MappedSuperclass or null if not mapped
*
* @param type class corresponding to the MappedSuperclass
* @return the MappedSuperclass
*/
org.hibernate.mapping.MappedSuperclass getMappedSuperclass(Class type);
/**
* Iterator over the MappedSuperclass mappings
* Use an iterator as a symetry to the other methods on Mappings
*
* @return mappedSuperclasses
*/
public Iterator iterateMappedSuperclasses();
} }