Hello Pay, > Is there a way to generate the same ENUM Class when using JOOQ code > generator?
In jOOQ 2.0.1, I have added experimental support for custom-defined enums in the source code generator. Here is the relevant release announcement: https://groups.google.com/forum/?fromgroups#!searchin/jooq-user/enum/jooq-user/rxMlFfu7LZk/KzIyDZ7NqKMJ Unfortunately, not all integration tests for custom-defined enums pass and I have not yet found the time to fix those failing tests yet. That is why this feature is not yet officially documented. For MySQL, however, most integration tests run smoothly. So if you're willing to beta-test this, you can give it a shot! There is an example jooq-codegen configuration here: https://github.com/lukaseder/jOOQ/blob/master/jOOQ-test/configuration/org/jooq/configuration/lukas/mysql/library.properties The two essential lines you'll have to add to your code generation configuration properties file are these: # Declare your own custom enum type (doesn't have to exist in the database) # In this case, the "synthetic" type is called BOOLEAN_YN_UC # and its values are Y and N (a comma-separated list of values) generator.database.enum-type.BOOLEAN_YN_UC="Y",N # Force that custom enum type upon all columns / parameters / attributes # that match a given regular expression. In this case, # table T_BOOLEANS # column Y_N_UC generator.database.forced-type.BOOLEAN_YN_UC=(?i:(.*?\.)?T_BOOLEANS\.Y_N_UC) Any feedback is welcome! Cheers Lukas
