Hi Kevin,
2017-05-10 3:22 GMT+02:00 Kevin Embree <[email protected]>: > Hi Lukas, > My initial approach of using HashMap didn't appear to work as I got > into an endless loop. Seems the hash function triggers the VisitListener. > Yes indeed. The default implementation of AbstractQueryPart.hashCode() (like equals()) is currently based on the SQL string generated from such QueryPart. A VisitListener should thus prevent infinite recursion and apply only once on the call stack. That can be a bit tricky, and hashCode() / equals() won't be the only places where this can happen. > > You idea for getSpecialField seemed a cleaner solution anyways, but in > my attempts to write it I referenced how JavaGenerator generates > getRecordVersion methods. > I was hoping to just extend the JavaGenerator class and override > generateTableClassFooter, but I ran into the problem that my method would > need the recordType and something like the following line (plucked from the > JavaGenerator).... > > final String recordType = out.ref(getStrategy().getFullJavaClassName(table > , Mode.RECORD)); > > Isn't possible as all out.ref methods are protected. > Hmm, yes indeed. A workaround would be to put your own generator in the same package as the JavaGenerator. You would then get access to those methods. But you don't really need out.ref(). That's used only to avoid full qualification of your type (registering the type in the import list). It will work just the same otherwise. > Am I missing an obvious way to get 'recordType'? I wouldn't be surprised > quite often the obvious stuff eludes me. > Don't blame yourself :) The current code generator wasn't really (well) designed for extension, so some things are simply much harder than they ought to be. We're hoping to fix things in this area in jOOQ 4.0 -- 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.
