-->
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: configuration of templatepath for hbm2java
PostPosted: Wed May 02, 2007 7:29 am 
Newbie

Joined: Mon May 09, 2005 7:57 am
Posts: 5
Hibernate version: 3.2.3.

Can i make a suggestion? When a user specifies the templatepath attribute for the hbm2java tool, and no templates can be found in that directory, can the user be informed that no templates were found?

I spent AGES fiddling around with this before i copped on that the templatepath must point to a directory WHICH MUST HAVE A SUB-DIRECTORY CALLED "pojo", with the templates (Pojo.ftl, etc) in it.

Instead, what i saw was that execution proceeded as normal, but hbm2java was obviously picking up the default templates from somewhere.

Even if the tool continues to do this, it would be nice to have a warning to the efect that the default templates are being read because no templates were found in the specified directory (p.s. make sure there is a "pojo" sub-directory...).

Or maybe I'm just missing some of the user guides? I saw no reference to this required structure for templates in the Hibernate Tools Reference Guide version 3.2.0 beta 9, which is about the only reference material I can find.

Should I log this request somewhere else?

TIA.
Donall.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 7:39 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
It's a bit of a shame you didn't read the README.txt that comes with the templates because it states quite clearly the following:
Code:
   Warning: Do *not* select the dao, hbm or pojo folder, please select the
            parent tempmlates folder only.

>.>

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 7:59 am 
Newbie

Joined: Mon May 09, 2005 7:57 am
Posts: 5
adamgibbons wrote:
It's a bit of a shame you didn't read the README.txt that comes with the templates because it states quite clearly the following:
Code:
   Warning: Do *not* select the dao, hbm or pojo folder, please select the
            parent tempmlates folder only.

>.>


Thanks Adam. You're quite clearly a very busy man, or maybe you're just under a lot of pressure at work or at home, so I appreciate your help. Can you point me towards this README.txt?


Top
 Profile  
 
 Post subject: Re: configuration of templatepath for hbm2java
PostPosted: Wed May 02, 2007 9:13 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
donall05 wrote:
Can i make a suggestion? When a user specifies the templatepath attribute for the hbm2java tool, and no templates can be found in that directory, can the user be informed that no templates were found?


This is a pretty good idea. If nothing else, a log.warn or the equivalent should be issued when specifying a templatepath and tools falls back to the default template because the template was not found. It is not necessarily an off-state, but a warn would be nice. I believe that you can submit this enhancement request to JIRA.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 9:41 am 
Senior
Senior

Joined: Sat Apr 21, 2007 11:01 pm
Posts: 144
donall05 wrote:
adamgibbons wrote:
It's a bit of a shame you didn't read the README.txt that comes with the templates because it states quite clearly the following:
Code:
   Warning: Do *not* select the dao, hbm or pojo folder, please select the
            parent tempmlates folder only.

>.>

Thanks Adam. You're quite clearly a very busy man, or maybe you're just under a lot of pressure at work or at home, so I appreciate your help. Can you point me towards this README.txt?

It's in the root directory of the templates folder, and I'm just a kid (aged 25). :P
Here's the whole file if you want to have a look:
Code:
MyEclipse Build ID: 20060122-4.1-GA
Date: 28th January 2006

Using custom templates with the MyEclipse 4.1.0 Hibernate Reverse-Engineering Process.

1) Unzip this archive into a convenient location. We recommend using a project
   in your Eclipse workspace.

2) Edit the velocity templates you are interested in customizing.
   
   Note:
   POJO templates are present in the pojo folder
   DAO template in the dao folder
   HBM templates in the hbm folder
   
3) Optional: Though not necessary, it is recommended that you delete the
   velocity templates you do not plan to customize. This will prevent future
   confusion over which templates are being processed by MyEclipse.

4) Invoke the Hibernate Reverse-Engineering wizard and select "Use custom
   templates". Manually enter or click the browse button to select the
   myeclipse_templates_4.1.0 folder. Note: the template location browser limits
   select to projects in the current workspace. Non-workspace location must be
   manually entered. (This location restriction will be lifted in MyEclipse
   4.1.1).
   
   Warning: Do *not* select the dao, hbm or pojo folder, please select the
            parent myeclipse_tempmlates_4.1.0 folder only.
   
5) During the code generation process, MyEclipse gives precedence to user
   defined templates by searching the custom template location prior to
   consulting the internal templates shipped with MyEclipse 4.1.
   
   

_________________
Everytime you get an answer to your question without giving credit; god kills a kitten. :(


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 02, 2007 11:07 am 
Newbie

Joined: Mon May 09, 2005 7:57 am
Posts: 5
Thanks Ananasi, i've logged it in JIRA (issue HBX-937).

Adam, for what it's worth, i am using the tools from ant, having extracted the hibernate-tools.jar file from the eclipse plugin. I can't find the readme file in either the eclipse plugin i downloaded or in the JAR i extracted. But i consider my point still to stand, as IMHO the README does not make it clear to a novice that the "pojo" directory (name) is a crucial part of the set-up. I only bring this up in the hope that other novices will not be stalled by the same unhelpful message/behaviour at this stage in the future.


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.