Hi,
I use XDOCLET to generate both hibernate.cfg.xml and *.hbm.xml
files. Here is the ant target to do both. please free to change it
accoridng to your needs.
NOTE : change the "xdoclet.classpath" property based on your classpath
<target name="hibernate" depends="init-xdoclet" description="creates
hibernate config file">
<taskdef name="hibernatedoclet"
classname="xdoclet.modules.hibernate.HibernateDocletTask"
classpathref="xdoclet.classpath" />
<hibernatedoclet
excludedtags="@version,@author,@todo"
destdir="${build.dir}"
force="false"
verbose="true">
<fileset dir="${java.dir}">
<include name="**/*.java" />
</fileset>
<hibernate version="2.0" />
<hibernatecfg
dataSource="java:/OracleDS"
dialect="org.hibernate.dialect.OracleDialect"
jndiname="java:/hibernate/SessionFactory"
cacheProviderClass="org.hibernate.cache.EhCacheProvider"
transactionManagerStrategy="org.hibernate.transaction.JTATran
sactionFactory"
transactionManagerLookup="org.hibernate.transaction.JBossTran
sactionManagerLookup" >
<otherProperty
name="current_session_context_class"
value="cdot.ctis.controller.ExtendedThreadLocalSessionContext" />
</hibernatecfg>
</hibernatedoclet>
</target> |