This content has been marked as final.
Show 3 replies
-
1. Re: removing table prefix for generate-entities ?
luizruiz Oct 26, 2007 7:46 AM (in response to taccart)You can use a custom ReverseEngineeringStrategy, overriding the tableToClassName or columnToPropertyName methods. Your class can extends org.hibernate.cfg.reveng.DelegatingReverseEngineeringStrategy.
-
2. Re: removing table prefix for generate-entities ?
taccart Oct 26, 2007 9:19 AM (in response to taccart)
Tell me if I'm on wrong tracks, I guess this must be set in the reveng used by seam ( jbossseamhome/seam-gen/hibernatetools/seam-gen.reveng.xml )
I've found in hibernate doc that "It is possible to implement a user strategy" (http://www.hibernate.org/hib_docs/tools/reference/en/html/reverseengineering.html#custom-reveng-strategy)
but it's not that much explicit
anyway, thanks for the extra fast answer :) -
3. Re: removing table prefix for generate-entities ?
taccart Oct 26, 2007 12:36 PM (in response to taccart)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