-->
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.  [ 5 posts ] 
Author Message
 Post subject: how to remove the tables ' prefix?
PostPosted: Thu Oct 27, 2005 7:49 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
I 've tables with prefix.

I want to generate hbm without prefix. how to?

by example:

table name : prefix_table_name

generated: table_name.hbm

_________________
I am the creatxr of world.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 12:18 pm 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
you can use your own RevengStrategy...
---------------
Code:
         
<jdbcconfiguration configurationfile="hibernate.cfg.xml"
               packagename="model"               
                            revengfile="hibernate.reveng.xml"
               reversestrategy="MyRevengStrategy"/>

---------------
Code:
public class MyRevengStrategy extends DelegatingReverseEngineeringStrategy {
   
   public MyRevengStrategy(ReverseEngineeringStrategy delegate) {
      super(delegate);
   }

   public String tableToClassName(TableIdentifier table) {
      String defaultClassName = super.tableToClassName(table);

      String newName = removePrefix(defaultClassName);
      return newName;
            
   }
               
   private String removePrefix() {
           // remove prefix
   }


}


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 31, 2005 12:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
we should probably add support for expressing this in reveng.xml since its probably quite common....
add a jira request if you want it.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 11:20 am 
Newbie

Joined: Mon Oct 31, 2005 12:01 pm
Posts: 12
max,

how can i customize the name of an generated set-attribute.
by default it is a name of table + 's'.
I coudn't find how to make it with ReverseEngineeringStrategy.

thanks in advance ...


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 02, 2005 11:24 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
columnToPropertyName, foreignKeyToCollectionName and foreignKeyToEntityName controls the naming of property, collection and entity references.

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