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: reveng extending base class , changing default generator
PostPosted: Thu Oct 26, 2006 4:20 am 
Newbie

Joined: Wed Oct 25, 2006 8:18 am
Posts: 4
Hi,

I am using Hibernate code generation via Eclipse plugin and very satisfied with that.

However, i have two simple questions.

1) all of my classes extend a base class DAO.
http://forum.hibernate.org/viewtopic.php?t=966050

link writes that we can do it. But i could not find out how. Is there an example of extending a based class we like?

2) all tables have an OID column with generator class uuid.

How can we make this as a default generator?

looks like in the configuration file, we have to specify the table name and column. Which means i have to write for all tables ? :(

Thanks a lot.
best regards.

ps : this is the copy of the following post to the right forum.
http://forum.hibernate.org/viewtopic.php?t=966399


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 26, 2006 8:50 am 
Expert
Expert

Joined: Tue Jul 11, 2006 10:21 am
Posts: 457
Location: Columbus, Ohio
1) With the latest SVN version, there exists a tableToMetaAttributes method which can add meta attributes to your hbm.xml files. Here is the code for the appropriate method of my ReverseEngineeringStrategy class:
Code:
   public Map tableToMetaAttributes(TableIdentifier tableIdentifier) {
      Map<String, MetaAttribute> metaAttributes = new HashMap<String, MetaAttribute>();

      // Generate the class-code meta attribute to add a default
      // serialVersionUID
      MetaAttribute classCode = new MetaAttribute("class-code");
      classCode.addValue("private static final long serialVersionUID = 1L;");
      metaAttributes.put("class-code", classCode);

      // Generate the extends meta attribute to extend all domain classes from
      // BaseModel
      MetaAttribute extendsCode = new MetaAttribute("extends");
      extendsCode.addValue("BaseModel");
      metaAttributes.put("extends", extendsCode);

      return metaAttributes;
   }


2) For now, you are better off overriding id.hbm.ftl template to make your own generator for your table identifiers, if you don't want to do it on a table-by-table basis in the reveng file. Just reply here if you need some assistance with that.


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.