-->
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.  [ 2 posts ] 
Author Message
 Post subject: Preferred code generation method
PostPosted: Mon Apr 25, 2005 8:04 am 
Beginner
Beginner

Joined: Sun Jan 16, 2005 5:45 pm
Posts: 24
Location: Atlanta
Preferred code generation method

I want to use hbm2java to generate domain PoJos with both abstract and concrete classes. I also want to generate DTOs and DAOs. I’m using Spring so I want to include the spring templating in the generated DAOs (see example below).

I have been learning the capabilities of hbm2java and velocity. However, many of the posts recommend extending BasicRenderer over using the velocity templating? Is this still true and why?

I also prefer using hbm2java within ANT. The hbm files that the current eclipse tool generates does not include the aggregates (sets/lists). I’m using MySQL. What I want to do is specify the relationships using MiddleGen then pass the hbms to hbm2java and generate the custom pojo’s, TDOs, and DAOs.

The roadmap http://www.hibernate.org/257.html includes comments about template based code generations. Is this via velocity?

What is the best path to custom code generation?
Middlegen -> hbm2java with custom velocity templates?

Code:
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
*/
package com.dygtig.domain.dao.hibernate;

import java.util.List;

import com.dygtig.domain.dao.*;
import com.dygtig.domain.businessobject.Actype;

import org.springframework.orm.hibernate3.support.*;

/**
* @author Baker
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
public class ActypeDaoHibernateImpl extends HibernateDaoSupport implements ActypeDao {

   public Actype getActypeById(Long id) {
      Actype actype = (Actype) this.getHibernateTemplate().load(Actype.class, id);
      System.out.println(actype.getModel());
      return actype;
   }


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 25, 2005 12:13 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
What does this mean:

Code:
The hbm files that the current eclipse tool generates does not include the aggregates (sets/lists).


As far as I know we do generate these associations ?

In H2 the BasicRenderer were much better than the velocity templates.

In H3 the velocity templates is the default method (because we have greatly improved it).

You can provide your own templates which can output your DAO's etc.

In cvs today we have a workinprogress EJB3 based DAO generation that you can take a look at for usage/inspiration.

_________________
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.  [ 2 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.