Hi! That seems to do the trick!! Thanks a lot Lukas.
Best, On Monday, 20 November 2017 11:07:44 UTC+1, Lukas Eder wrote: > > Hi Serge, > > Thanks for your message. That looks like an interesting case for "custom > code sections" in the code generator: > https://www.jooq.org/doc/latest/manual/code-generation/codegen-custom-code > > I could see a generated static method in the generated Schema class, which > does the switch for you. Something along the lines of: > > public UpdatableRecord<?> newRecord(Configuration configuration, String > json) { > switch (...) { > case "type1": > UpdatableRecord<?> record = > DSL.using(configuration).newRecord(Tables.TYPE1); > // ... > return record; > } > } > > > Does that help? > > Thanks, > Lukas > > 2017-11-17 14:24 GMT+01:00 <[email protected] <javascript:>>: > >> Hi everyone, >> >> I'm currently evaluating jOOQ for use with Amazon Redshift. We currently >> get events in a JSON format and I'm trying to find the best way to map the >> JSON structure to a specific jOOQ Record. These events have an event_type >> field that allows me to know which concrete record type to insert in the >> database. >> >> However, I'd like to avoid a very very big switch statement to make the >> decision in runtime. Assuming there's no better way, I'd like to generate >> this switch statement + deserialization logic using jOOQ's capabilities. It >> seems, though, that I can't generate new classes or global artifacts. Am I >> missing something or did I hit a limitation? >> >> Thank you, >> >> -- >> 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] <javascript:>. >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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.
