Hi :)
our database contains tables with column names using following naming convention: "FacilityKey", "FacilityID", "DataSource", ...
I am using hbm2hbmxml to generate all my data beanss with:
********************************************************
<jdbcconfiguration configurationfile="config/hibernate/db/dbinfo-${hdbname}.xml"
revengfile="config/hibernate/hibernate.reveng.xml" reversestrategy="com.myproject.MyReverseEngineeringStrategy"
/>
<hbm2hbmxml destdir="config/hibernate/auto/${hdbname}"/>
********************************************************
the output hibernate configuration file looks like:
******************************************************
...
<property name="facilityid" type="string">
<column name="FacilityID" length="50" not-null="true" />
</property>
<property name="datasource" type="string">
<column name="DataSource" length="8" not-null="true" />
</property>
...
********************************************************
When I run my queries against this table, somehow the column "FacilityID" gets translated into "facility_key" and "DataSource" to "data_source" which of course causes SQL errors (column not found).
I would like to be able to lowercase all column names during the configuration generation through MyReverseEngineeringStrategy which extends DelegatingReverseEngineeringStrategy. However, I am unable to find a method or way to change the actual column name. I found that overwriting the
public String columnToPropertyName(TableIdentifier table, String column){...}
method controls the column name of **property name="facilityid"** for example, but I am not able to control the actual column name as described through **column name="FacilityID"**
Any advice would really be appreciated. Also, let me know if you need any more information than what I have given here.
Thanks.
|