I could use this feature, too. However, not *every* column is like this in our case.
 
Our convention is tables have 4-letter abbreviations and are prefixed with a "T". For instances, our customer table is named TCUST_CUSTOMER. The fields within it are prefixed with CUST, so the name is CUST_NAME. Unfortunately, sometimes there are columns that don't have the prefix.
 
So, how about offering a regex-replace feature or something similar as a per-table property? That way both prefix and suffix conventions and others could be handled with the same code:
 
<property name="columnReplaceRegex" search="^CUST" replace=""/>
-----Original Message-----
From: Jeff Butler [mailto:[EMAIL PROTECTED]
Sent: Monday, October 23, 2006 2:33 PM
To: user-java@ibatis.apache.org
Subject: Re: column prefix with Abator

Well I guess the distinction between wierd and common depends on the projects you've worked on :)
 
What I really meant to convey is that there's no simple way to tell Abator to strip these prefixes off automatically.  Maybe if we added something like this:
 
  <property name="stripColumnPrefixCharacters" value="3" />
 
But there's got to be a better property name than that.
 
Jeff Butler
 
 


 
On 10/23/06, Landry Soules <[EMAIL PROTECTED]> wrote:
Thank you Jeff for your answer.

So I will have to use the columnOverride tag  :-(
However i can't agree with you about the weird db design. This syntax is
quite common in the enterprise world to avoid same field names between
tables.
Clinton Begin himself uses it extensively in his SQL Maps for Java,
Developer Guide...
< http://cvs.apache.org/dist/ibatis/ibatis.java/docs/iBATIS-SqlMaps-2_en.pdf>



Jeff Butler a écrit :
> You can do a <columnOverride> in the Abator configuration for each
> column to name the Java property specifically.  Not pretty, but that's
> probably the best that can be done with this wierd db design.
>
> Jeff Butler
>
>
>
> On 10/23/06, *Landry Soules* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>     Hello,
>
>     I'm a very new user of Ibatis, with abator eclipse plugin.
>     Here is my problem :
>     In my database, every column is prefixed with 2 letters from the
>     table
>     name :
>     for example table customer has the following columns : cs_first_name,
>     cs_last_name and so on.
>     When i run "generate ibatis artifacts", abator will generate a
>     Customer
>     bean, with csFirstName and csLastName properties, where i would have
>     expected firstName and lastName.
>     Did i miss a configuration parameter, or am i condamned to modify
>     all my
>     column names ?
>
>     Thanks for your answer.
>
>


Reply via email to