Hi everyone,
I'm currently digging into jOOQ's code generation feature, and I'm running
into issues with generated names.
Over the years, I have developed my own naming pattern, and thus I would
like to preserve names as they are, if possible. I will use some table and
view names to explain the situation and the approaches I already have taken.
Among others, I got the following tables and corresponding views in an H2
database:
Account
Server
ServerAccount
V_Account
V_Server
V_ServerAccount
And I'm trying to generate code for those while completely preserving the
names.
Here are the names I get from a plain generation run without any name
manipulation:
Account
Server
Serveraccount
VAccount
VServer
VServeraccount
That's not really what I wanted. A peek into the documentation led me to
approach #1:
<generator>
<!-- ... -->
<strategy>
<name>org.jooq.util.KeepNamesGeneratorStrategy</name>
</strategy>
</generator>
(Omitting the top level <configuration> tag and the <jdbc> section)
Resulting names:
ACCOUNT
SERVER
SERVERACCOUNT
V_ACCOUNT
V_SERVER
V_SERVERACCOUNT
Again, not quite. Digging further took me to approach #2:
<generator>
<!-- ... -->
<strategy>
<matchers>
<tables>
<table>
<!-- no expression on purpose -->
<tableClass>
<transform>AS_IS</transform>
</tableClass>
</table>
</tables>
</matchers>
</strategy>
</generator>
Result: Same as above.
Approach #3:
<generator>
<!-- ... -->
<strategy>
<matchers>
<tables>
<table>
<expression>(\w)+</expression>
<tableClass>
<expression>$0</expression>
</tableClass>
</table>
</tables>
</matchers>
</strategy>
</generator>
Again, the same result.
Finally, I tried to use AsInDatabaseStrategy, as defined in the
documentation:
<generator>
<!-- ... -->
<strategy>
<name>org.oddloot.db.AsInDatabaseStrategy</name>
</strategy>
</generator>
And this took me back to
Account
Server
Serveraccount
VAccount
VServer
VServeraccount
Of course, all these results are pretty much usable - only not quite what I
wanted.
Am I doing something fundamentally wrong here, or just missing something?
Any suggestions/hints really appreciated.
Cheers,
Carsten
--
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/d/optout.