MyBatis generator and mapUnderscoreToCamelCase setting

classic Classic list List threaded Threaded
4 messages Options
P A
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MyBatis generator and mapUnderscoreToCamelCase setting

P A
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MyBatis generator and mapUnderscoreToCamelCase setting

Jeff Butler
If you remove the "useActualColumnNames" property, then the generator will automatically make camel case field names for you.

Jeff Butler


On Fri, Feb 13, 2015 at 2:43 PM, P A <[hidden email]> wrote:
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.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
P A
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MyBatis generator and mapUnderscoreToCamelCase setting

P A
Thanks, it worked as per your suggestion.


On Friday, February 13, 2015 at 12:51:22 PM UTC-8, Jeff Butler wrote:
If you remove the "useActualColumnNames" property, then the generator will automatically make camel case field names for you.

Jeff Butler


On Fri, Feb 13, 2015 at 2:43 PM, P A <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2hdAavGDSpgJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">read...@...> wrote:
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: <a href="http://mybatis.github.io/mybatis-3/configuration.html#settings" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmybatis.github.io%2Fmybatis-3%2Fconfiguration.html%23settings\46sa\75D\46sntz\0751\46usg\75AFQjCNEUBAQK92Pc5ztMn7KjEknc1m6aKg';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmybatis.github.io%2Fmybatis-3%2Fconfiguration.html%23settings\46sa\75D\46sntz\0751\46usg\75AFQjCNEUBAQK92Pc5ztMn7KjEknc1m6aKg';return true;">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: <a href="http://mybatis.github.io/generator/configreference/xmlconfig.html" target="_blank" rel="nofollow" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmybatis.github.io%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGETuLO2zYGwIt_2GvOK1b1nIPq4Q';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fmybatis.github.io%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGETuLO2zYGwIt_2GvOK1b1nIPq4Q';return true;">http://mybatis.github.io/generator/configreference/xmlconfig.html

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

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2hdAavGDSpgJ" rel="nofollow" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href='https://groups.google.com/d/optout';return true;" onclick="this.href='https://groups.google.com/d/optout';return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MyBatis generator and mapUnderscoreToCamelCase setting

oleksandr.hlapov
In reply to this post by Jeff Butler
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».

On Friday, February 13, 2015 at 10:51:22 PM UTC+2, Jeff Butler wrote:
If you remove the "useActualColumnNames" property, then the generator will automatically make camel case field names for you.

Jeff Butler


On Fri, Feb 13, 2015 at 2:43 PM, P A <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="2hdAavGDSpgJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">read...@...> wrote:
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: <a href="http://mybatis.github.io/mybatis-3/configuration.html#settings" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.github.io%2Fmybatis-3%2Fconfiguration.html%23settings\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEUBAQK92Pc5ztMn7KjEknc1m6aKg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.github.io%2Fmybatis-3%2Fconfiguration.html%23settings\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEUBAQK92Pc5ztMn7KjEknc1m6aKg&#39;;return true;">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: <a href="http://mybatis.github.io/generator/configreference/xmlconfig.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.github.io%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGETuLO2zYGwIt_2GvOK1b1nIPq4Q&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fmybatis.github.io%2Fgenerator%2Fconfigreference%2Fxmlconfig.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGETuLO2zYGwIt_2GvOK1b1nIPq4Q&#39;;return true;">http://mybatis.github.io/generator/configreference/xmlconfig.html

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

--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="2hdAavGDSpgJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybatis-user...@googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...