-->
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.  [ 1 post ] 
Author Message
 Post subject: column names - DelegatingReverseEngineeringStrategy
PostPosted: Thu Jul 06, 2006 11:23 am 
Newbie

Joined: Thu Jul 06, 2006 11:08 am
Posts: 3
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.