-->
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.  [ 9 posts ] 
Author Message
 Post subject: Customize generated output... I'm lost
PostPosted: Fri Oct 28, 2005 11:41 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
I am trying to somehow customize the output that Hibernate Tools is generating, specifically the DAO classes and I would like to enable generics.

I am using the tools from within Eclipse - the plugin. So I am lost when reading the documentation and postings here. Say for enabling generics, the doc on Hibernate Ant Tools says to put something into a build.xml file.

I don't have such a file, and I don't actually know what it would be used for. My intention is to click on Hibernate Artifact Generation and go.

Am I missing something very basic here?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 28, 2005 1:20 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
there is a switch for the generics w/ no need to customize output, however I don't see one in the plugin version that I have installed. in true open source manner ... check cvs ;)

You can Customize generated output by clicking on the checkbox labelled "Use custom Templates" in the artifact generation wizard dialog screen. This will enable a template directory control for you to browse to. Specify a directory which contains dao/dao.vm , where dao/dao.vm is a copied resource from the hibernate-tools.jar.

This tells the plug in, don't use the velocity template in the jar file, use this one on my hard drive.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 3:50 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
I downloaded and installed the latest nightly build. Looked for a switch for producing generics and could not find one. Where would that switch be?

I now understand the custom templates, so this probably helps be getting the DAOs I want.
However, how can I tell the tools that I want a DAO interface and a DAO implementation for each class?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 5:21 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
its not in the ui at the moment. put a request in jira.

the last thing about additional codegeneration is best expressed via ant...when i get around to it you will have the same options in eclipse (by allowing dynamic addition of exporters in the ui)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 5:57 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
Which brings me back to my initial problem. How would I generate classes with generics today? As I don't have a build.xml file now, how would I create one that does what I want? Would this interfere with the stuff the plugin does?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 6:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you go read the docs at tools.hibernate.org about the ant files.

<hbm2java generics="true" ..> should give you a good start ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 6:44 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
My apologies for being slow off the mark. This is perhaps not event a H3 tools question.

My problem is not what to put in the build.xml, but the file in general.

I don't get an understanding where I would get a build.xml file from or how I would generate one in Eclipse. Furthermore, if I had one, how would I run the code generation? Would that be done automatically (if so when?) or can I trigger that manually (very much like I do now with the plugin).


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 6:50 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
best thing you could do then is to go read about Ant at ant.apache.org

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 4:24 am 
Newbie

Joined: Fri Oct 28, 2005 11:33 am
Posts: 13
Ok, I got it to work. The learning curve is quite steep if you come from the plugin UI and are pointed to the build.xml.

My second question was how to generate DAO interfaces and I will open another thread for that as it has nothing to do with this.


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