-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Specify database location through Ant property
PostPosted: Fri Mar 09, 2007 1:59 am 
Newbie

Joined: Fri Feb 16, 2007 12:05 am
Posts: 2
I am currently setting up Ant build script to generate database schema from Hibernate. The ant task I use is <hibernatetool />. The database is HSQLDB standalone version integrated with my standalone application.

During the build process I want to create database with schema in a subdirectory of my application directory, which is specified through an Ant property. However, hibernatetool takes db location from hibernate.cfg.xml file (hibernate.connection.url property). Are there anyway that I can specify the the connection url through Ant property in my build script?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 6:14 pm 
Newbie

Joined: Fri Oct 20, 2006 12:55 pm
Posts: 12
Hi Ejel,

I'm using hibernatetool as well. Here's a slice of my build file:

<target name="hibernate-base" depends="remove">
<antcall target="warning">
<param name="taskname" value="${taskname}"/>
</antcall>

<xdoclet2>
<!-- defines the files handled by xdoclet2 -->
<fileset dir="${src.dir}">
<include name="**/*.java"/>
</fileset>

<!-- defines the processing files to build hibernate .hbm.xml mapping files -->
<component
classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
destdir="${basedir}/src"
version="${hibernate.version}"
encoding="${hibernate.encoding}"/>

<!-- defines the processing to create a hibernate .cfg.xml file -->
<component
destdir="${src.dir}"
classname="org.xdoclet.plugin.hibernate.HibernateConfigPlugin"
jdbcdriver="${jdbc.driver}"
jdbcpassword="${jdbc.password}"
jdbcurl="${jdbc.url}"
jdbcusername="${jdbc.username}"
dialect="${hibernate.dialect}"
cacheprovider="${hibernate.cache.provider_class}"
cacheusequerycache="${hibernate.cache.use_query_cache}"
jdbcpoolsize="${hibernate.connection.pool_size}"
jdbcbatchsize="${hibernate.jdbc.batch_size}"
jdbcisolation="${hibernate.connection.isolation}"
showsql="${hibernate.show_sql}"
version="${hibernate.version}"
encoding="${hibernate.encoding}"/>

</xdoclet2>

<hibernatetool destdir="${webinf.dir}/sql">
<configuration configurationfile="${src.dir}/hibernate.cfg.xml"/>
<hbm2ddl export="false" update="false" drop="true" create="true" delimiter=";" outputfilename="${ddl.file}" format="true"/>
</hibernatetool>
</target>

...and you can include all of the properties mentioned with a tag like this:
<property file="${basedir}/hibernate.properties"/>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.