protected void reset() { implicitNamingStrategy = ImplicitNamingStrategyJpaCompliantImpl.INSTANCE; physicalNamingStrategy = PhysicalNamingStrategyStandardImpl.INSTANCE; namedQueries = new HashMap<String,NamedQueryDefinition>(); namedSqlQueries = new HashMap<String,NamedSQLQueryDefinition>(); sqlResultSetMappings = new HashMap<String, ResultSetMappingDefinition>(); namedEntityGraphMap = new HashMap<String, NamedEntityGraphDefinition>(); namedProcedureCallMap = new HashMap<String, NamedProcedureCallDefinition>( ); standardServiceRegistryBuilder = new StandardServiceRegistryBuilder( bootstrapServiceRegistry ); entityTuplizerFactory = new EntityTuplizerFactory(); interceptor = EmptyInterceptor.INSTANCE; properties = new Properties( ); properties.putAll( standardServiceRegistryBuilder.getSettings()); }
/** * Construct am instance of the default tuplizer for the given entity-mode. * * @param entityMode The entity mode for which to build a default tuplizer. * @param metamodel The entity metadata. * @param persistentClass The entity mapping info. * * @return The instantiated tuplizer * * @throws HibernateException If no default tuplizer found for that entity-mode; may be re-thrown from * {@link #constructTuplizer} too. */ public EntityTuplizer constructDefaultTuplizer( EntityMode entityMode, EntityMetamodel metamodel, PersistentClass persistentClass) { Class<? extends EntityTuplizer> tuplizerClass = defaultImplClassByMode.get( entityMode ); if ( tuplizerClass == null ) { throw new HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" ); } return constructTuplizer( tuplizerClass, metamodel, persistentClass ); }
private boolean hasProperConstructor(Class<? extends EntityTuplizer> tuplizerClass, Class[] constructorArgs) { return getProperConstructor( tuplizerClass, constructorArgs ) != null && ! ReflectHelper.isAbstractClass( tuplizerClass ); }
/** * Method allowing registration of the tuplizer class to use as default for a particular entity-mode. * * @param entityMode The entity-mode for which to register the tuplizer class * @param tuplizerClass The class to use as the default tuplizer for the given entity-mode. */ public void registerDefaultTuplizerClass(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) { assert isEntityTuplizerImplementor( tuplizerClass ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] does not implement " + EntityTuplizer.class.getName(); // TODO: for now we need constructors for both PersistentClass and EntityBinding assert hasProperConstructor( tuplizerClass, ENTITY_TUP_CTOR_SIG ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] is not properly instantiatable"; defaultImplClassByMode.put( entityMode, tuplizerClass ); }
final String tuplizerClassName = persistentClass.getTuplizerImplClassName( entityMode ); if ( tuplizerClassName == null ) { entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, persistentClass ); entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClassName, this, persistentClass );
public void applyEntityTuplizer(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) { this.entityTuplizerFactory.registerDefaultTuplizerClass( entityMode, tuplizerClass ); }
final String tuplizerClassName = persistentClass.getTuplizerImplClassName( entityMode ); if ( tuplizerClassName == null ) { entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, persistentClass ); entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClassName, this, persistentClass );
/** * Method allowing registration of the tuplizer class to use as default for a particular entity-mode. * * @param entityMode The entity-mode for which to register the tuplizer class * @param tuplizerClass The class to use as the default tuplizer for the given entity-mode. */ public void registerDefaultTuplizerClass(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) { assert isEntityTuplizerImplementor( tuplizerClass ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] does not implement " + EntityTuplizer.class.getName(); // TODO: for now we need constructors for both PersistentClass and EntityBinding assert hasProperConstructor( tuplizerClass, ENTITY_TUP_CTOR_SIG ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] is not properly instantiatable"; assert hasProperConstructor( tuplizerClass, ENTITY_TUP_CTOR_SIG_NEW ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] is not properly instantiatable"; defaultImplClassByMode.put( entityMode, tuplizerClass ); }
public void configure(Configuration cfg) { super.configure( cfg ); cfg.getEntityTuplizerFactory().registerDefaultTuplizerClass( EntityMode.POJO, MyEntityTuplizer.class ); }
final String tuplizerClassName = persistentClass.getTuplizerImplClassName( entityMode ); if ( tuplizerClassName == null ) { entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, persistentClass ); entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClassName, this, persistentClass );
/** * Method allowing registration of the tuplizer class to use as default for a particular entity-mode. * * @param entityMode The entity-mode for which to register the tuplizer class * @param tuplizerClass The class to use as the default tuplizer for the given entity-mode. */ public void registerDefaultTuplizerClass(EntityMode entityMode, Class<? extends EntityTuplizer> tuplizerClass) { assert isEntityTuplizerImplementor( tuplizerClass ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] does not implement " + EntityTuplizer.class.getName(); // TODO: for now we need constructors for both PersistentClass and EntityBinding assert hasProperConstructor( tuplizerClass, ENTITY_TUP_CTOR_SIG ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] is not properly instantiatable"; assert hasProperConstructor( tuplizerClass, ENTITY_TUP_CTOR_SIG_NEW ) : "Specified tuplizer class [" + tuplizerClass.getName() + "] is not properly instantiatable"; defaultImplClassByMode.put( entityMode, tuplizerClass ); }
/** * Construct an instance of the given tuplizer class. * * @param tuplizerClassName The name of the tuplizer class to instantiate * @param metamodel The metadata for the entity. * @param persistentClass The mapping info for the entity. * * @return The instantiated tuplizer * * @throws HibernateException If class name cannot be resolved to a class reference, or if the * {@link Constructor#newInstance} call fails. */ @SuppressWarnings({ "unchecked" }) public EntityTuplizer constructTuplizer( String tuplizerClassName, EntityMetamodel metamodel, PersistentClass persistentClass) { try { Class<? extends EntityTuplizer> tuplizerClass = ReflectHelper.classForName( tuplizerClassName ); return constructTuplizer( tuplizerClass, metamodel, persistentClass ); } catch ( ClassNotFoundException e ) { throw new HibernateException( "Could not locate specified tuplizer class [" + tuplizerClassName + "]" ); } }
/** * Construct an instance of the given tuplizer class. * * @param tuplizerClass The tuplizer class to instantiate * @param metamodel The metadata for the entity. * @param persistentClass The mapping info for the entity. * * @return The instantiated tuplizer * * @throws HibernateException if the {@link Constructor#newInstance} call fails. */ public EntityTuplizer constructTuplizer( Class<? extends EntityTuplizer> tuplizerClass, EntityMetamodel metamodel, PersistentClass persistentClass) { Constructor<? extends EntityTuplizer> constructor = getProperConstructor( tuplizerClass, ENTITY_TUP_CTOR_SIG ); assert constructor != null : "Unable to locate proper constructor for tuplizer [" + tuplizerClass.getName() + "]"; try { return constructor.newInstance( metamodel, persistentClass ); } catch ( Throwable t ) { throw new HibernateException( "Unable to instantiate default tuplizer [" + tuplizerClass.getName() + "]", t ); } }
entityTuplizerFactory = new EntityTuplizerFactory();
private void registerXPojoEntityTuplizer() { this.getEntityTuplizerFactory().registerDefaultTuplizerClass( EntityMode.POJO, XPojoEntityTuplizer.class); }
entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, entityBinding ); entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClass, this, entityBinding );
/** * Construct am instance of the default tuplizer for the given entity-mode. * * @param entityMode The entity mode for which to build a default tuplizer. * @param metamodel The entity metadata. * @param persistentClass The entity mapping info. * * @return The instantiated tuplizer * * @throws HibernateException If no default tuplizer found for that entity-mode; may be re-thrown from * {@link #constructTuplizer} too. */ public EntityTuplizer constructDefaultTuplizer( EntityMode entityMode, EntityMetamodel metamodel, PersistentClass persistentClass) { Class<? extends EntityTuplizer> tuplizerClass = defaultImplClassByMode.get( entityMode ); if ( tuplizerClass == null ) { throw new HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" ); } return constructTuplizer( tuplizerClass, metamodel, persistentClass ); }
private boolean hasProperConstructor(Class<? extends EntityTuplizer> tuplizerClass, Class[] constructorArgs) { return getProperConstructor( tuplizerClass, constructorArgs ) != null && ! ReflectHelper.isAbstractClass( tuplizerClass ); }
entityTuplizerFactory = new EntityTuplizerFactory();
entityTuplizer = entityTuplizerFactory.constructDefaultTuplizer( entityMode, this, entityBinding ); entityTuplizer = entityTuplizerFactory.constructTuplizer( tuplizerClass, this, entityBinding );