Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## xdoclet.modules.hibernate
Class HibernateCfgSubTask

    java.lang.Object
      xdoclet.DocletSupport
          xdoclet.SubTask
              xdoclet.TemplateSubTask
                  xdoclet.XmlSubTask
                      xdoclet.modules.hibernate.HibernateCfgSubTask

All Implemented Interfaces:
  xdoclet.modules.hibernate.HibernateProperties, Serializable

public class HibernateCfgSubTask
extends XmlSubTask
implements xdoclet.modules.hibernate.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
See Also:
  Serialized Form
ant.element
  name="hibernatecfg" display-name="Hibernate Configuration File Generation" parent="xdoclet.modules.hibernate.HibernateDocletTask"
created
  February 6, 2004

Nested Class Summary
`static class` | `HibernateCfgSubTask.HibernateCFGVersion` Based on Matt Raible's code for the Hibernate sub-task.

Nested classes inherited from class xdoclet.TemplateSubTask
`TemplateSubTask.ExtentTypes, TemplateSubTask.OfType`

Field Summary

Fields inherited from class xdoclet.DocletSupport
`currentClassTag, currentFieldTag, currentMethodTag`

Constructor Summary
`HibernateCfgSubTask()` Constructor for the HibernateSubTask object

Method Summary
`void` | `addConfiguredJndiProperty(org.apache.tools.ant.types.Parameter jndiProperty)` These elements allow you to add properties to the JNDI context.
`void` | `addOtherMapping(org.apache.tools.ant.types.Parameter otherMapping)` These elements allow you to add arbitrary mappings to cfg.xml file.
`void` | `addOtherProperty(org.apache.tools.ant.types.Parameter otherProperty)` These elements allow you to add arbitrary properties to cfg.xml file.
`protected void` | `engineStarted()` Called when the engine is started
`void` | `execute()` Generate Hibernate Configuration file (hibernate.cfg.xml).
`String` | `getCacheProviderClass()`
`String` | `getCglibUseReflectionOptimizer()`
`String` | `getDataSource()`
`String` | `getDefaultSchema()`
`String` | `getDialect()`
`String` | `getDriver()`
`String` | `getHbm2ddl()`
`String` | `getJdbcUrl()`
`String` | `getJndiName()`
`Collection` | `getJndiProperties()`
`Collection` | `getOtherMappings()`
`Collection` | `getOtherProperties()`
`String` | `getPassword()`
`String` | `getPoolSize()`
`boolean` | `getShowSql()`
`String` | `getTransactionManagerFactory()`
`String` | `getTransactionManagerLookup()`
`String` | `getTransactionManagerStrategy()`
`boolean` | `getUseOuterJoin()`
`String` | `getUserName()`
`String` | `getUserTransactionName()`
`String` | `getVersion()` Get the Hibernate configuration DTD version.
`void` | `setCacheProviderClass(String string)` The classname of a custom CacheProvider.
`void` | `setCglibUseReflectionOptimizer(String string)` Enables use of CGLIB instead of runtime reflection (System-level property, default is to use CGLIB where possible).
`void` | `setDataSource(String dataSource)` JNDI name of data source to use in the session factory.
`void` | `setDefaultSchema(String string)` Qualify unqualified tablenames with the given schema/tablespace in generated SQL.
`void` | `setDialect(String dialect)` SQL dialect of the database.
`void` | `setDriver(String driver)` JDBC Driver to make database connection.
`void` | `setHbm2ddl(String hbm2ddl)` Automatically export schema DDL to the database when the SessionFactory is created.
`void` | `setJdbcUrl(String jdbcUrl)` URL for the JDBC Driver to make the connection to the database.
`void` | `setJndiName(String jndiName)` JNDI name to bind to the `SessionFactory`
`void` | `setPassword(String password)` Use this password to login to the database
`void` | `setPoolSize(String poolSize)` Hibernate connection pool size.
`void` | `setShowSql(boolean showSql)` Log sql statements.
`void` | `setTransactionManagerFactory(String string)` The classname of a TransactionFactory to use with Hibernate Transaction API (defaults to JDBCTransactionFactory).
`void` | `setTransactionManagerLookup(String transactionManagerLookup)` The fully qualified class name of the Hibernate `TransactionFactory` implementation.
`void` | `setTransactionManagerStrategy(String transactionManagerStrategy)` Strategy for obtaining the JTA `TransactionManager`
`void` | `setUseOuterJoin(boolean useOuterJoin)` Whether to use outer join
`void` | `setUserName(String userName)` Use this user name to login to the database
`void` | `setUserTransactionName(String userTransactionName)` The JNDI name of the JTA UserTransaction object
`void` | `setVersion(HibernateCfgSubTask.HibernateCFGVersion version)` Sets the hibernate configuration DTD version to use.
`void` | `validateOptions()` Called to validate configuration parameters.

Methods inherited from class xdoclet.XmlSubTask
`copyAttributesFrom, engineFinished, getDtdURL, getPublicId, getSchema, getSchemaURL, getSystemId, getUseIds, getXmlencoding, isValidateXML, setDtdURL, setPublicId, setSchema, setSchemaURL, setSystemId, setUseIds, setValidateXML, setXmlencoding, startProcess`

Methods inherited from class xdoclet.TemplateSubTask
`addOfType, addOfType, addPackageSubstitution, generateForClass, getAcceptAbstractClasses, getAcceptInterfaces, getDestinationFile, getEngine, getExtent, getGeneratedFileName, getGenerationManager, getHavingClassTag, getOfType, getPackageSubstitutions, getSubTaskClassName, getTemplateURL, init, isPackageSubstitutionInheritanceSupported, isPrefixWithPackageStructure, javaFile, matchesGenerationRules, processInnerClasses, setAcceptAbstractClasses, setAcceptInterfaces, setDestinationFile, setEngine, setExtent, setExtentValue, setGenerationManager, setHavingClassTag, setOfType, setPackageSubstitutionInheritanceSupported, setPackageSubstitutions, setPrefixWithPackageStructure, setSubTaskClassName, setTemplateFile, setTemplateURL, startEngine, startProcessForAll, startProcessPerClass`

Methods inherited from class xdoclet.SubTask
`addConfigParam, getConfigParams, getConfigParamsAsMap, getContext, getDestDir, getMergeDir, getSubTaskName, getXJavaDoc, setDestDir, setMergeDir, setSubTaskName`

Methods inherited from class xdoclet.DocletSupport
`getCurrentClass, getCurrentClassTag, getCurrentConstructor, getCurrentField, getCurrentFieldTag, getCurrentMethod, getCurrentMethodTag, getCurrentPackage, getCurrentTag, isDocletGenerated, popCurrentClass, pushCurrentClass, setCurrentClass, setCurrentClassTag, setCurrentConstructor, setCurrentField, setCurrentFieldTag, setCurrentMethod, setCurrentMethodTag, setCurrentPackage`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### HibernateCfgSubTask

    public HibernateCfgSubTask()

  Constructor for the HibernateSubTask object

Method Detail

### getVersion

    public String getVersion()

  Get the Hibernate configuration DTD version.

  Returns:

### getHbm2ddl

    public String getHbm2ddl()

### getTransactionManagerLookup

    public String getTransactionManagerLookup()

### getJndiProperties

    public Collection getJndiProperties()

  Specified by:
    `getJndiProperties` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getOtherProperties

    public Collection getOtherProperties()

  Specified by:
    `getOtherProperties` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getOtherMappings

    public Collection getOtherMappings()

  Specified by:
    `getOtherMappings` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getTransactionManagerStrategy

    public String getTransactionManagerStrategy()

  Specified by:
    `getTransactionManagerStrategy` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getUserTransactionName

    public String getUserTransactionName()

  Specified by:
    `getUserTransactionName` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getUserName

    public String getUserName()

  Specified by:
    `getUserName` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getPassword

    public String getPassword()

  Specified by:
    `getPassword` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getUseOuterJoin

    public boolean getUseOuterJoin()

  Specified by:
    `getUseOuterJoin` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getShowSql

    public boolean getShowSql()

  Specified by:
    `getShowSql` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getJndiName

    public String getJndiName()

  Specified by:
    `getJndiName` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getDataSource

    public String getDataSource()

  Specified by:
    `getDataSource` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getDialect

    public String getDialect()

  Specified by:
    `getDialect` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getDriver

    public String getDriver()

  Specified by:
    `getDriver` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getJdbcUrl

    public String getJdbcUrl()

  Specified by:
    `getJdbcUrl` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getPoolSize

    public String getPoolSize()

  Specified by:
    `getPoolSize` in interface `xdoclet.modules.hibernate.HibernateProperties`

### getCacheProviderClass

    public String getCacheProviderClass()

  Returns:

### getCglibUseReflectionOptimizer

    public String getCglibUseReflectionOptimizer()

  Returns:

### getDefaultSchema

    public String getDefaultSchema()

  Returns:

### getTransactionManagerFactory

    public String getTransactionManagerFactory()

  Returns:

### 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` -

### 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` -

### setPoolSize

    public void setPoolSize(String poolSize)

  Hibernate connection pool size.

  Parameters:
    `poolSize` -

### setJdbcUrl

    public void setJdbcUrl(String jdbcUrl)

  URL for the JDBC Driver to make the connection to the database.

  Parameters:
    `jdbcUrl` -

### setTransactionManagerStrategy

    public void setTransactionManagerStrategy(String transactionManagerStrategy)

  Strategy for obtaining the JTA `TransactionManager`

  Parameters:
    `transactionManagerStrategy` -

### setUserTransactionName

    public void setUserTransactionName(String userTransactionName)

  The JNDI name of the JTA UserTransaction object

  Parameters:
    `userTransactionName` -

### setTransactionManagerLookup

    public void setTransactionManagerLookup(String transactionManagerLookup)

  The fully qualified class name of the Hibernate `TransactionFactory` implementation.

  Parameters:
    `transactionManagerLookup` -

### setUseOuterJoin

    public void setUseOuterJoin(boolean useOuterJoin)

  Whether to use outer join

  Parameters:
    `useOuterJoin` -

### setShowSql

    public void setShowSql(boolean showSql)

  Log sql statements. Defaults to false.

  Parameters:
    `showSql` -

### setJndiName

    public void setJndiName(String jndiName)

  JNDI name to bind to the `SessionFactory`

  Parameters:
    `jndiName` -

### setDataSource

    public void setDataSource(String dataSource)

  JNDI name of data source to use in the session factory.

  Parameters:
    `dataSource` -

### setDialect

    public void setDialect(String dialect)

  SQL dialect of the database.

  Parameters:
    `dialect` -
  ant.required
    Yes. Use fully-qualified class name.

### setDriver

    public void setDriver(String driver)

  JDBC Driver to make database connection.

  Parameters:
    `driver` -

### setUserName

    public void setUserName(String userName)

  Use this user name to login to the database

  Parameters:
    `userName` -

### setPassword

    public void setPassword(String password)

  Use this password to login to the database

  Parameters:
    `password` -

### setCacheProviderClass

    public void setCacheProviderClass(String string)

  The classname of a custom CacheProvider.

  Parameters:
    `string` -

### 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` -

### setDefaultSchema

    public void setDefaultSchema(String string)

  Qualify unqualified tablenames with the given schema/tablespace in generated SQL.

  Parameters:
    `string` -

### 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` -

### execute

    public void execute()
                 throws XDocletException

  Generate Hibernate Configuration file (hibernate.cfg.xml).

  Overrides:
    `execute` in class `TemplateSubTask`
  Throws:
    `XDocletException`

### validateOptions

    public void validateOptions()
                         throws XDocletException

  Description copied from class: `TemplateSubTask`
  Called to validate configuration parameters.

  Overrides:
    `validateOptions` in class `TemplateSubTask`
  Throws:
    `XDocletException` - Description of Exception

### addConfiguredJndiProperty

    public void addConfiguredJndiProperty(org.apache.tools.ant.types.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` -

### addOtherProperty

    public void addOtherProperty(org.apache.tools.ant.types.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

### addOtherMapping

    public void addOtherMapping(org.apache.tools.ant.types.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

### engineStarted

    protected void engineStarted()
                          throws XDocletException

  Called when the engine is started

  Overrides:
    `engineStarted` in class `TemplateSubTask`
  Throws:
    `XDocletException` - Thrown in case of problem

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| http://xdoclet.sourceforge.net/
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD