Dimitris Mouchritsas wrote:
Hi folks, I'm trying to create a condition task so as not to run a
hibernatedoclet target.
The problem is the target does not produce .hbm.xml files for all the
classes. So
for example if we have 3 classes in the src dir say, User.java, Account.java,
Login.java
the resulting files in the build dir might look like:
User.class
User.hbm.xml
Account.class
Account.hbm.xml
Login.class
So not all classes have a hibernate configuration file. My problem is how
can I use uptodate
to check these? I've tried this:
<uptodate>
<srcfiles dir="${src.dir}">
<include name="**/mypackage/domain/**/*.java" />
</srcfiles>
<chainedmapper>
<globmapper from="*" to="${domain.build.dir}" />
<compositemapper>
<globmapper from="*.java" to="*.class" />
<globmapper from=".java" to="*.hbm.xml" />
</compositemapper>
</chainedmapper>
</uptodate>
But I guess this mapper needs every class to have a corresponding .hbm.xml
I could imagine a trick here. after running hibernate, you copy
**/*.class to a separate location. Then, after compiling your source,
you want compare the base *.java to the build/hibernate/**/*.class. this
will trigger hibernate if any class has changed.
Some other options
-restrict the include list to everything that generates a hibernate
file. if they are all in one package, or all have a specific name, life
is much easier.
-move to JPA annotations+hibernate. This works pretty well in the java5+
world; I prefer it to hibernate in many ways.
--
Steve Loughran http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]