org.sqlproc.engine.hibernate.HibernateEngineFactory Maven / Gradle / Ivy
package org.sqlproc.engine.hibernate;
import org.sqlproc.engine.SqlEngineFactory;
import org.sqlproc.engine.SqlProcessorLoader;
import org.sqlproc.engine.SqlDefaultFactory;
import org.sqlproc.engine.hibernate.type.HibernateTypeFactory;
/**
* The implementation of the {@link SqlEngineFactory} optimized for the Hibernate stack.
*
*
* It's suitable mainly for the Spring DI based configuration, like the next one for the new loader
* {@link SqlProcessorLoader}:
*
*
* <beans ...>
* ...
* <bean id="sqlFactory" class="org.sqlproc.engine.hibernate.HibernateEngineFactory" init-method="init">
* <property name="metaFilesNames">
* <list>
* <value>statements.qry</value>
* </list>
* </property>
* </bean>
* </beans>
*
*
* and use the next code to obtain an instance of the SQL Query engine
*
*
* SqlQueryEngine sqlEngine = sqlFactory.getQueryEngine("ALL");
*
*
* or the next code to obtain an instance of the SQL CRUD engine
*
*
* SqlCrudEngine sqlEngine = sqlFactory.getCrudEngine("ALL");
*
*
*
* For more info please see the Tutorials.
*
* @author Vladimir Hudec
*/
public class HibernateEngineFactory extends SqlDefaultFactory {
/**
* Creates a new instance with default values for the Hibernate stack.
*/
public HibernateEngineFactory() {
super();
setJdbc(false);
setTypeFactory(HibernateTypeFactory.getInstance());
}
/**
* Creates a new instance with default values for the Hibernate stack.
*
* @param lazyInit
* this flag indicates to speed up the initialization process.
*/
public HibernateEngineFactory(boolean lazyInit) {
super(lazyInit);
setJdbc(false);
setTypeFactory(HibernateTypeFactory.getInstance());
}
/**
* Creates a new instance with no default values.
*
* @param asyncInitThreads
* number of threads used for asynchronous initialization
*/
public HibernateEngineFactory(int asyncInitThreads) {
super(asyncInitThreads);
setJdbc(false);
setTypeFactory(HibernateTypeFactory.getInstance());
}
/**
* Creates a new instance with no default values.
*
* @param lazyInit
* this flag indicates to speed up the initialization process.
* @param asyncInitThreads
* number of threads used for asynchronous initialization
*/
public HibernateEngineFactory(boolean lazyInit, int asyncInitThreads) {
super(lazyInit, asyncInitThreads);
setJdbc(false);
setTypeFactory(HibernateTypeFactory.getInstance());
}
}