-->
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.  [ 5 posts ] 
Author Message
 Post subject: My codeGen does not creates any POJO´s when looks so
PostPosted: Thu Apr 17, 2008 7:32 pm 
Newbie

Joined: Thu Apr 17, 2008 7:20 pm
Posts: 4
Hi Im using Hibernate 2 and while trying to create any Pojos using codeGen got no java classes at all. Aparently all went ok because my ant log says so, but got no java classes:

Buildfile: C:\Documents and Settings\ChirlazZ\Escritorio\Apps Struts\PruebaAnt\Model\build.xml

codegen:

BUILD SUCCESSFUL
Total time: 1 second

My build.xml is:

<?xml version="1.0"?>
<project name="Test del chili"
basedir=".">
<!-- Set up properties containing important project directories -->
<property name="source.root" value="src"/>
<property name="class.root" value="classes"/>
<property name="lib.dir" value="lib"/>
<property name="data.dir" value="data"/>

<!-- 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>
</path>

<!-- Teach Ant how to use Hibernate's code generation tool -->
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="project.class.path"/>

<!-- Generate the java code for all mapping files in our source tree -->
<target name="codegen"
description="Generate Java source from the O/R mapping files">
<hbm2java output="${source.root}">
<fileset dir="${source.root}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
<!-- Create our runtime subdirectories and copy resources into them -->
<target name="prepare" description="Sets up build structures">
<mkdir dir="${class.root}"/>

<!-- Copy our property files and O/R mappings for use at runtime -->
<copy todir="${class.root}" >
<fileset dir="${source.root}" >
<include name="**/*.properties"/>
<include name="**/*.hbm.xml"/>
</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">
<classpath refid="project.class.path"/>
</javac>
</target>

<!-- Generate the schemas for all mapping files in our class tree -->
<target name="schema" depends="compile"
description="Generate DB schema from the O/R mapping files">

<!-- Teach Ant how to use Hibernate's schema generation tool -->
<taskdef name="schemaexport"
classname="net.sf.hibernate.tool.hbm2ddl.SchemaExportTask"
classpathref="project.class.path"/>

<schemaexport properties="${class.root}/hibernate.properties"
quiet="no" text="no" drop="no" delimiter=";">
<fileset dir="${class.root}">
<include name="**/*.hbm.xml"/>
</fileset>
</schemaexport>
</target>

</project>

*************+
one of my hbm.xml:

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//hibernate/hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">

<hibernate-mapping>
<class name="model.pojos.Articulo" table="Articulo">
<id name="id" column="articulo_id" type="long">
<generator class="increment"/>
</id>
<property name="nombre" type="string"/>
<property name="categoria" type="string"/>
<property name="descripcion" type="string"/>
<property name="precio" type="string"/>
</class>
</hibernate-mapping>

Thanks 4 your reading/helping


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 12:37 am 
Senior
Senior

Joined: Mon Feb 25, 2008 1:48 am
Posts: 191
Location: India
I used hibernate 3 and my build.xml was something like this:

Code:
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />
<hibernatetool destdir="test" >
<configuration configurationfile="hibernate.cfg.xml">
     <fileset dir=".">
      <include name="*.hbm.xml"/>
   </fileset>
</configuration>
<hbm2java/>
</hibernatetool>

_________________
Sukirtha


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 18, 2008 2:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so what is the output ?

apparently it does not find any *.hbm.xml files.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Javagen problems
PostPosted: Fri Apr 18, 2008 5:15 am 
Newbie

Joined: Thu Apr 17, 2008 7:20 pm
Posts: 4
thanks for the answer, but still the same problem. I m actually trying using a proper build.xml with hb3. Could you please attach your complete build.xml file?
thanks

any more help??


Top
 Profile  
 
 Post subject: JavaGEn probbs fixed.
PostPosted: Fri Apr 18, 2008 5:59 am 
Newbie

Joined: Thu Apr 17, 2008 7:20 pm
Posts: 4
The only probb was the classpath for ant, bacause i m using jdeveloper, and it uses its own jars!!!

Thanks anyway lads!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.