Hi Sirguy, This is the expected behaviour of the DefaultGeneratorStrategy. You can override this behaviour by rolling your own strategy as documented here: http://www.jooq.org/doc/3.0/manual/code-generation/codegen-advanced
This will allow you to keep camel-casing the way it is defined in the database. An example can be found here: https://github.com/jOOQ/jOOQ/blob/master/jOOQ-test/configuration/org/jooq/configuration/lukas/sqlserver/AdventureWorksStrategy.java Cheers Lukas 2013/5/14 Sirguy Chikirev <[email protected]> > I expected that if my database tables names already in the CamelCase form > that I like, generator will preserve this form for the generated class name. > But it is convert names in: first letter in UpperCase and the rest of the > name in LowerCase form. This happens even if table name do not have any > underscore char. > I think that will be more correctly generate class name as close as > possible to the tables name. > > The fix is easy. > > in the class *org.jooq.tools.StringUtils* at static method* toCamelCase* > check if name does not contains any underscore and if it is correct java > class name use it as is. Else correct and beautify it > > smth. like this > > public static String toCamelCase(String string) { > > StringBuilder result = new StringBuilder(); > > > > if(string.indexOf()==-1) > > if(Character.isDigit( string.charAt(0))) > > string="_" +string; > > else > > > > for (String word : string.split("_")) { > > > > // Uppercase first letter of a word > > if (word.length() > 0) { > > > > // [#82] - If a word starts with a digit, prevail > the > > // underscore to prevent naming clashes > > if (Character.isDigit(word.charAt(0))) { > > result.append("_"); > > } > > > > result.append(word.substring(0, 1).toUpperCase()); > > result.append(word.substring(1).toLowerCase()); > > } > > > > > With best regards ! Sirguy. > > -- > You received this message because you are subscribed to the Google Groups > "jOOQ User Group" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
