jQuery in Action, 3rd edition
The moose likes Object Relational Mapping and the fly likes hibernate/xdoclet works in one directory but not another Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "hibernate/xdoclet works in one directory but not another" Watch "hibernate/xdoclet works in one directory but not another" New topic

hibernate/xdoclet works in one directory but not another

Siegfried Heintze
Ranch Hand

Joined: Aug 11, 2000
Posts: 397
I have a simple eclipse project and I cannot get the hibernatedoclet to work. No errors but no hbm files either.

So I downloaded the code that accompanies the book XDoclet in Action and ran the build files. Viola -- I get Blog.hbm.xml files. OK, so I move my one pojo ("Person.java") from my eclipse project file to the "XDoclet in Action" directory and run the build again and I get Person.hbm.xml. Good.

So I move and rename my build file that came with the "XDoclet in Action" files to my eclipse project. I also move Blog.java to my eclipse project and run the same build file that worked before. No luck. No error messages. No hbm files.

I know that hibernate is reading the files because it complains if I introduce syntax errors.


<?xml version="1.0" encoding="UTF-8"?>

<project name="Blog" default="generate-hibernate" basedir=".">
<property name="xdoclet.lib.dir" value="C:\Documents and Settings\Siegfried\My Documents\dev\XDoclet\xdoclet-1.2.3\lib" />
<property name="lib.dir" value="C:\Documents and Settings\Siegfried\My Documents\dev\hibernate\hibernate-3.0" />
<property name="hibernate.dir" value="hbm2" />
<property name="src.dir" value="com/puregamesinc/dao/src" />
<property name="merge.dir" value="merge" />

<path id="xdoclet.lib.path">
<fileset dir="${xdoclet.lib.dir}">
<include name="*.jar"/>
<fileset dir="${lib.dir}">
<include name="*.jar"/>

<target name="generate-hibernate">
<taskdef name="hibernatedoclet"
classpathref="xdoclet.lib.path" />

<!-- Generate Hibernate mapping files -->
<hibernatedoclet destdir="${hibernate.dir}"
<fileset dir="com/puregamesinc/dao/src">
<include name="**/Blog.java" />

<hibernate version="2.0" />
Wim Drapier

Joined: Jul 20, 2005
Posts: 11
Just a guess by taking a quick look at the ant code and I see some Spaces. This is not a good idea, so you may want to try again after you moved your files to a directory that has no spaces.
I agree. Here's the link: http://aspose.com/file-tools
subject: hibernate/xdoclet works in one directory but not another
It's not a secret anymore!