##### Search XDoclet

## hibernatecfg

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.

### Implementing Class

xdoclet.modules.hibernate.HibernateCfgSubTask

### Attributes

Attribute | Description | Required
--- | --- | ---
version | Sets the hibernate configuration DTD version to use. Legal values are "2.0" and "3.0". Valid values: 2.0, 3.0 | No. Default is "2.0".
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 | No.
poolSize | Hibernate connection pool size. | No.
jdbcUrl | URL for the JDBC Driver to make the connection to the database. | No.
transactionManagerStrategy | Strategy for obtaining the JTA `TransactionManager` | No.
userTransactionName | The JNDI name of the JTA UserTransaction object | No.
transactionManagerLookup | The fully qualified class name of the Hibernate `TransactionFactory` implementation. | No.
useOuterJoin | Whether to use outer join | No. Defaults to false.
showSql | Log sql statements. Defaults to false. | No.
jndiName | JNDI name to bind to the `SessionFactory` | No.
dataSource | JNDI name of data source to use in the session factory. | No.
dialect | SQL dialect of the database. | Yes. Use fully-qualified class name.
driver | JDBC Driver to make database connection. | No.
userName | Use this user name to login to the database | No.
password | Use this password to login to the database | No.
cacheProviderClass | The classname of a custom CacheProvider. | No.
cglibUseReflectionOptimizer | 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. | No.
defaultSchema | Qualify unqualified tablenames with the given schema/tablespace in generated SQL. | No.
transactionManagerFactory | The classname of a TransactionFactory to use with Hibernate Transaction API (defaults to JDBCTransactionFactory). eg. classname.of.TransactionFactory | No.
useIds | If this attribute is set to true, XDoclet will generate id attributes in the XML document. Note that this is only available in some subtasks. | No. Default is "false"
xmlencoding | The encoding of the produced xml file. If your XML file uses international characters, you might want to set this to "ISO-8859-1". | No, default is "UTF-8"
schema | The XML Schema to which the generated document should conform. | No.
validateXML | If this is set to true, the generated XML will be validated against its DTD or XML Schema. | No, default is false.
acceptInterfaces | Indicates whether or not to generate for interfaces. | No, default is "true"
acceptAbstractClasses | Indicates whether or not to generate for abstract classes. | No, default is "true"
packageSubstitutions | Sets the PackageSubstitutions attribute of the TemplateSubTask object | No.
packageSubstitutionInheritanceSupported | Indicates whether or not package substitution should be inherited | No, default is "true"
prefixWithPackageStructure | Indicates whether or not to prefix with package structure. | No, default is "true"
destinationFile | The destination file name. If a {0} is found it's assumed that a per class output generation is needed, so {0} is substituted with class name; otherwise a single file is generated with the specified name. | No, default is determined by this task.
templateFile | Sets the name of the template file to use for generation | No, default is determined by this task.
havingClassTag | Sets the HavingClassTag attribute of the TemplateSubTask object | No.
ofType |  | No.
subTaskName | Sets an optional name for the subtask that will be seen in XDoclet's debug messages. | No.
destDir | Sets the directory where the generated file(s) will be written. | No.
mergeDir | Specifies the location of the merge directory. This is where XDoclet will look for merge files. | No.

### Nested Elements

Element | Description
--- | ---
configParam | Specifies a configuration parameter for the subtask.
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".
ofType |
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.
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.
packageSubstitution | Substitutes the package of the generated files.