[jboss-user] [JBoss Seam] - Re: removing table prefix for generate-entities ?
taccart
do-not-reply at jboss.com
Fri Oct 26 12:36:54 EDT 2007
Okay, here's the solution:
1/ create your class:
| import org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy;
| import org.hibernate.cfg.reveng.ReverseEngineeringStrategy;
| import org.hibernate.cfg.reveng.TableIdentifier;
|
|
| public class ExampleStrategy extends DelegatingReverseEngineeringStrategy {
|
| public ExampleStrategy (ReverseEngineeringStrategy delegate) {
| super(delegate);
| }
|
| @Override
| public String tableToClassName(TableIdentifier ti) {
| // TODO Auto-generated method stub
| if (ti.getName().startsWith("TP_XS_",0))
| { return ti.getName().substring(7).toLowerCase();
| }
| else
| return super.tableToClassName(ti); //
| }
|
| }
|
2/ build the corresponding ExampleStrategy.jar
3/ copy your jar to your /seam-gen/lib
4/ Update the seam-gen/build.xml for target generate-entities:
Add attribute reversestrategy to jdbcconfiguration :
| <jdbcconfiguration propertyfile="build.properties"
| reversestrategy="ExampleStrategy"
| packagename="${model.package}"
| revengfile="${project.home}/resources/seam-gen.reveng.xml"
| detectmanytomany="false"/>
|
Read more info on hibernate ant tools : http://www.hibernate.org/hib_docs/tools/reference/en/html/ant.html
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4099408#4099408
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4099408
More information about the jboss-user
mailing list