xdoclet.modules.hibernate

Class HibernateCfgSubTask

public class HibernateCfgSubTask extends XmlSubTask implements HibernateProperties

Generate the hibernate.cfg.xml file. It lists all of the properties as well as a property for each hbm.xml file. This file can be used for creating and installing a SessionFactory in JNDI as well as launching Hibern8IDE.

Version: $Revision: 1.10 $

Author: Frederick N. Brier David Channon

UNKNOWN: February 6, 2004 name = "hibernatecfg" display-name = "Hibernate Configuration File Generation" parent = "xdoclet.modules.hibernate.HibernateDocletTask"

Nested Class Summary
static classHibernateCfgSubTask.HibernateCFGVersion
Based on Matt Raible's code for the Hibernate sub-task.
Constructor Summary
HibernateCfgSubTask()
Constructor for the HibernateSubTask object
Method Summary
voidaddConfiguredJndiProperty(Parameter jndiProperty)
These elements allow you to add properties to the JNDI context.
voidaddOtherMapping(Parameter otherMapping)
These elements allow you to add arbitrary mappings to cfg.xml file.
voidaddOtherProperty(Parameter otherProperty)
These elements allow you to add arbitrary properties to cfg.xml file.
protected voidengineStarted()
Called when the engine is started
voidexecute()
Generate Hibernate Configuration file (hibernate.cfg.xml).
StringgetCacheProviderClass()
StringgetCglibUseReflectionOptimizer()
StringgetDataSource()
StringgetDefaultSchema()
StringgetDialect()
StringgetDriver()
StringgetHbm2ddl()
StringgetJdbcUrl()
StringgetJndiName()
CollectiongetJndiProperties()
CollectiongetOtherMappings()
CollectiongetOtherProperties()
StringgetPassword()
StringgetPoolSize()
booleangetShowSql()
StringgetTransactionManagerFactory()
StringgetTransactionManagerLookup()
StringgetTransactionManagerStrategy()
booleangetUseOuterJoin()
StringgetUserName()
StringgetUserTransactionName()
StringgetVersion()
Get the Hibernate configuration DTD version.
voidsetCacheProviderClass(String string)
The classname of a custom CacheProvider.
voidsetCglibUseReflectionOptimizer(String string)
Enables use of CGLIB instead of runtime reflection (System-level property, default is to use CGLIB where possible).
voidsetDataSource(String dataSource)
JNDI name of data source to use in the session factory.
voidsetDefaultSchema(String string)
Qualify unqualified tablenames with the given schema/tablespace in generated SQL.
voidsetDialect(String dialect)
SQL dialect of the database.
voidsetDriver(String driver)
JDBC Driver to make database connection.
voidsetHbm2ddl(String hbm2ddl)
Automatically export schema DDL to the database when the SessionFactory is created.
voidsetJdbcUrl(String jdbcUrl)
URL for the JDBC Driver to make the connection to the database.
voidsetJndiName(String jndiName)
JNDI name to bind to the SessionFactory
voidsetPassword(String password)
Use this password to login to the database
voidsetPoolSize(String poolSize)
Hibernate connection pool size.
voidsetShowSql(boolean showSql)
Log sql statements.
voidsetTransactionManagerFactory(String string)
The classname of a TransactionFactory to use with Hibernate Transaction API (defaults to JDBCTransactionFactory). eg. classname.of.TransactionFactory
voidsetTransactionManagerLookup(String transactionManagerLookup)
The fully qualified class name of the Hibernate TransactionFactory implementation.
voidsetTransactionManagerStrategy(String transactionManagerStrategy)
Strategy for obtaining the JTA TransactionManager
voidsetUseOuterJoin(boolean useOuterJoin)
Whether to use outer join
voidsetUserName(String userName)
Use this user name to login to the database
voidsetUserTransactionName(String userTransactionName)
The JNDI name of the JTA UserTransaction object
voidsetVersion(HibernateCfgSubTask.HibernateCFGVersion version)
Sets the hibernate configuration DTD version to use.
voidvalidateOptions()

Constructor Detail

HibernateCfgSubTask

public HibernateCfgSubTask()
Constructor for the HibernateSubTask object

Method Detail

addConfiguredJndiProperty

public void addConfiguredJndiProperty(Parameter jndiProperty)
These elements allow you to add properties to the JNDI context. For instance, if you do not want Weblogic clustering to replicate the Hibernate SessionFactory, add a jndiProperty element with a "name" attribute of "weblogic.jndi.replicateBindings" and a "value" attribute of "false".

Parameters: jndiProperty

UNKNOWN: No.Emptyarray ofelements.

addOtherMapping

public void addOtherMapping(Parameter otherMapping)
These elements allow you to add arbitrary mappings to cfg.xml file. For instance, if you want to specify that a jar contains /example/myHibernate.hbm.xml file then specify a other mapping with the name="resource" and the value being the path to the mapping.

Parameters: otherMapping The feature to be added to the OtherMapping attribute

UNKNOWN: No.Emptyarray ofelements.

addOtherProperty

public void addOtherProperty(Parameter otherProperty)
These elements allow you to add arbitrary properties to cfg.xml file. For instance, if you want to provide your own "connection.provider_class" class then add a property called connection.provider_class with a value of whatever you want passed in.

Parameters: otherProperty The feature to be added to the OtherProperty attribute

UNKNOWN: No.Emptyarray ofelements.

engineStarted

protected void engineStarted()
Called when the engine is started

Throws: XDocletException Thrown in case of problem

execute

public void execute()
Generate Hibernate Configuration file (hibernate.cfg.xml).

Throws: XDocletException

getCacheProviderClass

public String getCacheProviderClass()

Returns:

getCglibUseReflectionOptimizer

public String getCglibUseReflectionOptimizer()

Returns:

getDataSource

public String getDataSource()

getDefaultSchema

public String getDefaultSchema()

Returns:

getDialect

public String getDialect()

getDriver

public String getDriver()

getHbm2ddl

public String getHbm2ddl()

getJdbcUrl

public String getJdbcUrl()

getJndiName

public String getJndiName()

getJndiProperties

public Collection getJndiProperties()

getOtherMappings

public Collection getOtherMappings()

getOtherProperties

public Collection getOtherProperties()

getPassword

public String getPassword()

getPoolSize

public String getPoolSize()

getShowSql

public boolean getShowSql()

getTransactionManagerFactory

public String getTransactionManagerFactory()

Returns:

getTransactionManagerLookup

public String getTransactionManagerLookup()

getTransactionManagerStrategy

public String getTransactionManagerStrategy()

getUseOuterJoin

public boolean getUseOuterJoin()

getUserName

public String getUserName()

getUserTransactionName

public String getUserTransactionName()

getVersion

public String getVersion()
Get the Hibernate configuration DTD version.

Returns:

setCacheProviderClass

public void setCacheProviderClass(String string)
The classname of a custom CacheProvider.

Parameters: string

UNKNOWN:

setCglibUseReflectionOptimizer

public void setCglibUseReflectionOptimizer(String string)
Enables use of CGLIB instead of runtime reflection (System-level property, default is to use CGLIB where possible). Reflection can sometimes be useful when troubleshooting.

Parameters: string

UNKNOWN:

setDataSource

public void setDataSource(String dataSource)
JNDI name of data source to use in the session factory.

Parameters: dataSource

UNKNOWN:

setDefaultSchema

public void setDefaultSchema(String string)
Qualify unqualified tablenames with the given schema/tablespace in generated SQL.

Parameters: string

UNKNOWN:

setDialect

public void setDialect(String dialect)
SQL dialect of the database.

Parameters: dialect

UNKNOWN: Yes.Usefully-qualified classname.

setDriver

public void setDriver(String driver)
JDBC Driver to make database connection.

Parameters: driver

UNKNOWN:

setHbm2ddl

public void setHbm2ddl(String hbm2ddl)
Automatically export schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitely. eg. update | create | create-drop

Parameters: hbm2ddl

UNKNOWN:

setJdbcUrl

public void setJdbcUrl(String jdbcUrl)
URL for the JDBC Driver to make the connection to the database.

Parameters: jdbcUrl

UNKNOWN:

setJndiName

public void setJndiName(String jndiName)
JNDI name to bind to the SessionFactory

Parameters: jndiName

UNKNOWN:

setPassword

public void setPassword(String password)
Use this password to login to the database

Parameters: password

UNKNOWN:

setPoolSize

public void setPoolSize(String poolSize)
Hibernate connection pool size.

Parameters: poolSize

UNKNOWN:

setShowSql

public void setShowSql(boolean showSql)
Log sql statements. Defaults to false.

Parameters: showSql

UNKNOWN:

setTransactionManagerFactory

public void setTransactionManagerFactory(String string)
The classname of a TransactionFactory to use with Hibernate Transaction API (defaults to JDBCTransactionFactory). eg. classname.of.TransactionFactory

Parameters: string

UNKNOWN:

setTransactionManagerLookup

public void setTransactionManagerLookup(String transactionManagerLookup)
The fully qualified class name of the Hibernate TransactionFactory implementation.

Parameters: transactionManagerLookup

UNKNOWN:

setTransactionManagerStrategy

public void setTransactionManagerStrategy(String transactionManagerStrategy)
Strategy for obtaining the JTA TransactionManager

Parameters: transactionManagerStrategy

UNKNOWN:

setUseOuterJoin

public void setUseOuterJoin(boolean useOuterJoin)
Whether to use outer join

Parameters: useOuterJoin

UNKNOWN: No.Defaultsto false.

setUserName

public void setUserName(String userName)
Use this user name to login to the database

Parameters: userName

UNKNOWN:

setUserTransactionName

public void setUserTransactionName(String userTransactionName)
The JNDI name of the JTA UserTransaction object

Parameters: userTransactionName

UNKNOWN:

setVersion

public void setVersion(HibernateCfgSubTask.HibernateCFGVersion version)
Sets the hibernate configuration DTD version to use. Legal values are "2.0" and "3.0".

Parameters: version

UNKNOWN: No.Defaultis "2.0".

validateOptions

public void validateOptions()