-->
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: Hibernate Doclet not generating hbm.xml file
PostPosted: Tue Sep 21, 2004 8:08 pm 
Newbie

Joined: Thu Sep 02, 2004 12:53 am
Posts: 5
The XDoclet tool is not generating the hbm.xml files.
Here is what I did:

I downloaded xdoclet-1.2.2-SNAPSHOT
In my src foler, I put the:
xdoclet-1.2.2-SNAPSHOT\docs\ant\xdoclet folder

so now there's an src\xdoclet folder

In my lib directory I created a folde called xdoclet and in it I put the *.jar files from the xdoclet-1.2.2-SNAPSHOT\lib folder.

In my classpath I included the tools.jar file from my C:\j2sdk1.4.2_04\lib
in my CLASSPATH.


I also dl ANT and created a System environment variable called ANT_HOME with the C:\apache-ant-1.6.2-bin

In my PATH environemtn variable I included
%ANT_HOME%\bin

It does not seem like the HibernateDoclet is generating hbm.xml files.

Here is my build.xml file:

<?xml version="1.0"?>
<project name="test" default="compile" basedir=".">
<property name="source.root" value="src"/>
<property name="class.root" value="classes"/>
<property name="lib.dir" value="lib"/>
<property name="generated.home" value="generated"/>


<!-- Set up the class path for compilation and execution -->
<path id="project.class.path">
<!-- Include our own classes, of course -->
<pathelement location="${class.root}" />
<!-- Include jars in the project library directory -->
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${class.root}"/>
</path>

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




<!-- Create our runtime subdirectories and copy resources into them -->
<target name="prepare" description="Sets up build structures">
<mkdir dir="${class.root}"/>
<mkdir dir="${generated.home}"/>

<!-- Copy our property files and O/R mappings for use at runtime -->
<copy todir="${class.root}" >
<fileset dir="${source.root}" >
<include name="**/*.properties"/>
</fileset>
</copy>
</target>

<!-- Compile the java source of the project -->
<target name="compile" depends="prepare"
description="Compiles all Java classes">
<javac srcdir="${source.root}"
destdir="${class.root}"
debug="on"
optimize="off"
deprecation="on"
classpathref="project.class.path">
<classpath>
<path refid="project.class.path"/>
<pathelement location="${class.root}"/>
</classpath>
</javac>
</target>

<target name="generate" description="Generates Hibernate class descriptor files." depends="compile">
<!-- Define the hibernatedoclet task -->
<taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask" classpathref="xdoclet.lib.path"/>

<!-- Execut the hibernatedoclet task -->
<hibernatedoclet
destdir="${generated.home}"
excludedtags="@version,@author,@todo"
force="${generated.forced}"
mergedir="${generated.home}"
verbose="false">

<fileset dir="${source.root}">
<include name="**/*.java"/>
</fileset>

<hibernate version="2.0"/>

</hibernatedoclet>
</target>



</project>


When I type: 'ant generate' into the command line
I get:

C:\hibernate-2.1\practice9>ant generate
Buildfile: build.xml

prepare:
[mkdir] Created dir: C:\hibernate-2.1\practice9\classes
[mkdir] Created dir: C:\hibernate-2.1\practice9\generated
[copy] Copying 3 files to C:\hibernate-2.1\practice9\classes

compile:
[javac] Compiling 2 source files to C:\hibernate-2.1\practice9\classes

generate:
[hibernatedoclet] log4j:WARN No appenders could be found for logger (xdoclet.uti
l.Translator.getString).
[hibernatedoclet] log4j:WARN Please initialize the log4j system properly.

BUILD SUCCESSFUL
Total time: 14 seconds


So it BUILDS SUCCESSFUL but there is no hbm.xml files generated.
Why would that be?


Top
 Profile  
 
 Post subject: U forgot hibernatecfg tag
PostPosted: Wed Sep 22, 2004 4:44 pm 
Newbie

Joined: Mon Sep 20, 2004 10:27 am
Posts: 7
You need to use <hibernatecfg> for generating cfg file.


Code:

<hibernatedoclet .....
             <hibernatecfg poolsize="${poolsize}"
                                   .....
              />
</hibernatedoclet>

It has been some time since I did this.. I am not sure there is any new and better way of doing it.

But for me it works fine


_________________
Rgds,

--Siva Jagadeesan
Application Developer
ThoughtWorks, Inc


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.