-->
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.  [ 4 posts ] 
Author Message
 Post subject: Changing Home suffix to DAO with Hibernate Tools
PostPosted: Wed Mar 11, 2009 5:58 pm 
Newbie

Joined: Tue Mar 11, 2008 8:21 am
Posts: 4
Eclipse JEE version: 3.4
Hibernate version: 3.3.1.GA
Hibernate Tools version: 3.2.4.CR2

I'm using Hibernate Tools Eclipse Plugin to generate DAO's from a database using Hibernate Core (ie not JPA or EJB3 or Annotations, nor Java5). The default generation uses a Home suffix when generating DAO's, I'd like to change it to use a DAO suffix instead.

I've tried changing the FreeMarker template dao/daohome.ftl from adding the suffix Home to DAO. When the tool is run the class generates with the DAO suffix, but the java file still generates with a Home suffix. I end up with a XYZHome.java file with a XYXDAO class.

I've tried subclassing DefaultReverseEngineeringStrategy and overridding the method tableToClassName, but it seems to add the suffix after calling this method.

Any pointers on how to change this would be appreciated.


Top
 Profile  
 
 Post subject: Implementing Exporter
PostPosted: Fri Mar 13, 2009 10:02 am 
Newbie

Joined: Tue Mar 11, 2008 8:21 am
Posts: 4
Turns out the DAOExporter is the one that needs to be extended to create whatever suffix you want. Would be nice if this could be parametrized in some way.

I've now turned my attention to writing an new Exporter. I noticed that the Hibernate Tools provides an extension point for writing new Exporters. I didn't have much time, but wrote one quickly and it ended up throwing a NullPointerException in the getColumnImage method. I didn't save the code. I backed out the plugin and it seemed to have some lasting effect on the Hibernate Tools, because clicking on Add Exporter doesn't work anymore.

Has anyone successfully made a plugin that extends the exporter extension point?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 15, 2009 1:37 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Yes, all the exporters in hibernate is done this way (but never really documented since the api is not guaranteed to be stable like the hbmtemplate is)

Didn't a restart work for you after the exception ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 16, 2009 9:53 am 
Newbie

Joined: Tue Mar 11, 2008 8:21 am
Posts: 4
After backing out the plugin, I ended up having to start eclipse with the -clean option. Then everything worked again.


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