columnRenamingRule - custom implementation

11 views
Skip to first unread message

Radim Hartmann

unread,
Nov 16, 2012, 5:59:57 PM11/16/12
to mybati...@googlegroups.com
Hello all,

I have not nice name columns in DB and I would like to map them on Java field nicely according cammel convension
TD_AAABBB_ID -> tdAaaBbbId
TD_BBBCCC_ID -> tdBbbCccId
.....

It is possible to create custom plugin where will be store this "hashMap" or "dictionary" and
when on the output came TD_AAABBB_ID -> will be transfer to tdAaaBbbId?

Actually it has to be rename on two places. In Java class and in BaseResultMap....

Thx for help

Guy Rouillier

unread,
Nov 16, 2012, 6:36:06 PM11/16/12
to mybati...@googlegroups.com
You can do that easily in your ResultMap. What are you looking for that
ResultMap does not provide?

--
Guy Rouillier

Radim Hartmann

unread,
Nov 16, 2012, 7:13:44 PM11/16/12
to mybati...@googlegroups.com
I know that in generator I can use this
<columnOverride column="TD_AAABBB_ID" property="tdAaaBbbId " />

but I have around 20 bad naming columns in 150 tables and I do not want to each time to write this tag
<columnOverride column="TD_AAABBB_ID" property="tdAaaBbbId " />

Any Idea?


Dne sobota, 17. listopadu 2012 0:36:17 UTC+1 Guy napsal(a):

Guy Rouillier

unread,
Nov 17, 2012, 5:49:41 PM11/17/12
to mybati...@googlegroups.com
On 11/16/2012 7:13 PM, Radim Hartmann wrote:
> I know that in generator I can use this
> <columnOverride column="TD_AAABBB_ID" property="tdAaaBbbId " />
>
> but I have around 20 bad naming columns in 150 tables and I do not want
> to each time to write this tag
> <columnOverride column="TD_AAABBB_ID" property="tdAaaBbbId " />
>
> Any Idea?

How many times are you going to run the generator? I would guess at
most once or twice. If I had this issue and anticipated running the
generator repeatedly, I would just create a shell script (batch file for
Windows) that did a file search and replace string.

--
Guy Rouillier
Reply all
Reply to author
Forward
0 new messages