MyBatis generator and mapUnderscoreToCamelCase setting

726 views
Skip to first unread message

P A

unread,
Feb 13, 2015, 2:43:45 PM2/13/15
to mybati...@googlegroups.com
Hi,

I have just started using MyBatis generator to generate my Java model. However all the Java files are being generated with field names having underscores. (Since the database columns have underscores).
Some of the tables have 50+ columns, and I hate to manually replace the underscores with came case names.

I came across mapUnderscoreToCamelCase setting: http://mybatis.github.io/mybatis-3/configuration.html#settings
But I am not sure where this setting should go.

At present I am using generatorConfig.xml, and that does not support <settings> or <setting> element at all: http://mybatis.github.io/generator/configreference/xmlconfig.html

Please help me mapping my column names to came case Java fields. TIA.

Jeff Butler

unread,
Feb 13, 2015, 3:51:22 PM2/13/15
to mybati...@googlegroups.com
If you remove the "useActualColumnNames" property, then the generator will automatically make camel case field names for you.

Jeff Butler


--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mybatis-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

P A

unread,
Feb 13, 2015, 8:02:30 PM2/13/15
to mybati...@googlegroups.com
Thanks, it worked as per your suggestion.

oleksand...@gmail.com

unread,
Aug 9, 2017, 2:24:53 PM8/9/17
to mybatis-user
artifact generator 5.1.43. Not sure is it a bug or a feature: when column name starts with capital letter geterator is using toLowerCase(). I.e. let's say table column name is «CanProcessPayment», genearator will create variable with name «canprocesspayment».
Reply all
Reply to author
Forward
0 new messages