-->
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.  [ 7 posts ] 
Author Message
 Post subject: Is there a tool to generate DAO methods code?
PostPosted: Thu Jan 08, 2004 11:01 pm 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Is there a tool to generate DAO methods? Methods about query, insert, update, delete.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 1:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
hbm2java has the ability to generate finders.
You can generalise the other operations into a base domain class.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 2:09 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
I tried it. But I found only a method named "findAll" exist in a xxxFinder.java.
My xml like that:
<property column="WORK_ID" length="20" name="workId" type="java.lang.String">
<meta attribute="finder-method">findByWorkId</meta>
</property>
<property column="LOGIN_NAME" length="20" name="loginName" type="java.lang.String">
<meta attribute="finder-method">findByLoginName</meta>
</property>
My hibernate-extensions is 2.0.3.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 2:15 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Did you create the config file?

Have a look at http://www.hibernate.org/hib_docs/reference/html/toolsetguide.html#toolsetguide-s2-3
Maybe it will help.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 2:18 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
yes, I created it.
config.xml
<codegen>
<generate renderer="net.sf.hibernate.tool.hbm2java.BasicRenderer"/>
<generate suffix="Finder" renderer="net.sf.hibernate.tool.hbm2java.FinderRenderer"/>
</codegen>
command:
hbm2java.bat --config=config.xml SysUser.hbm.xml


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 3:10 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
try to use "finder" instead of "finder-method" - it's a bug in the current release of hbm2java - it is fixed in cvs.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 4:00 am 
Regular
Regular

Joined: Wed Dec 03, 2003 9:41 pm
Posts: 87
Thank you.


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