-->
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.  [ 6 posts ] 
Author Message
 Post subject: New Ant Tasks: Are they usable yet?
PostPosted: Fri Apr 08, 2005 6:40 am 
Newbie

Joined: Fri Apr 08, 2005 6:26 am
Posts: 6
Location: Edinburgh, UK
I think this is aimed at Max,

Are the new ant tasks in a usable state yet? I have been sifting through the code and trying to get them to work. I have put together a basic build.xml file but I get a NullPointerException when I uncomment the hbm2Java and hbm2dll entries. Have I declared them incorrectly or is the code not usable yet?

Regards,
Chris Holman

<!-- Teach Ant how to use Hibernate's code generation tool -->
<taskdef name="hibernateTools"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="project.class.path"/>

<!-- Generate the java code for all mapping files in our source tree -->
<target name="-pre-compile" >
<hibernateTools destDir="${generated.source.root}">
<!--hbm2Java templatesPath="${source.root}"/-->
</hibernateTools>
</target>

<!-- Generate the schemas for all mapping files in our class tree -->
<target name="-post-compile">
<hibernateTools destDir="${generated.source.root}">
<!--hbm2ddl update="true" drop="true" outputFilename="test.ddl"/-->
</hibernateTools>
</target>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 1:55 pm 
Newbie

Joined: Tue Apr 05, 2005 11:19 pm
Posts: 5
It works. According to the docs (plugins/org.hibernate.eclipse.console_3.0.0.alpha2/doc/index.html):
To use the task you have to specify one or more of the following:

* (Optional) A classpath that contains the needed classes
* (Required) One of the following:
o <configuration> - uses a normal Hibernate Configuration.
o <annotationconfiguration> - Supports using jdk 1.5/JSR-220 annotated classes. Specify classes/packages to load in your hibernate.cfg.xml
o <jdbcconfiguration> - Will reverse engineer the database and create classes/associations based on the JDBC meta data.
* (Required) One or more of the "generators" that operates on the above chosen configuration.
o <hbm2dll> - a.k.a. schemaexport, exports and/or executes the SQL DDL for the configuration to the database
o <hbm2java> - a.k.a. codegenerator, generates a set of .java files
o <cfg2hbm> - generates a set .hbm files. Mostly used together with a <jdbcconfiguration>
o <cfg2cfgXml>- generates a set .cfg.xml file. Mostly used together with a <jdbcconfiguration>

You are missing a configuration tag in your examples. Here is a snippet that works for me:

<hibernatetool destdir="${dir.gensrc}">
<configuration>
<fileset dir="${dir.hbm}">
<include name="**/*.hbm.xml"/>
</fileset>
</configuration>
<hbm2java/>
</hibernatetool>


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 4:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
seems like im missing some error handling for a missing configuraiton.

but besides that - yes they are usable. (but that said i found a bug today that makes hbm2java kinda only half usable so it is recommended to get the cvs version of tools if you want a fully working hbm2java)

-max

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 4:50 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
i would appreciate if you could go add this NPE stacktrace and ant configuration to JIRA so i can fix it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Official build?
PostPosted: Mon Apr 11, 2005 4:10 am 
Beginner
Beginner

Joined: Sat Feb 26, 2005 12:09 pm
Posts: 27
Location: Helsinki, Finland
Are there plans to do an intermediate official milestone build of the Ant tasks (or command line tools if they are there) or is cvs the only way for now?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 11, 2005 4:54 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
cvs is where you get the latest.

im trying to setup some kind of updatesite where you will be able to get a recent build (including all the plugins/cmd line tools), but that is still in the todo-loop ,)

_________________
Max
Don't forget to rate


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