2016-05-18 18:59 GMT+02:00 Devin Austin <[email protected]>: > >> The simplest way forward might be to extend the default DAOImpl and let >> the code generator use your custom DAOImpl as a base class using generator >> strategies: >> >> One option using generator strategies would be to implement "custom code >> sections", where you can add your own methods to the generated DAOs: >> >> http://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy >> >> Another option would be to extend the generated DAOs and add >> functionality on a per-table basis. >> >> But of course, your suggested option is fine, too. >> >> > Extending the generated DAOs might not be so bad. I'll read up on what > you've sent me, thanks! >
Alright. Let me know how it goes, and if you encounter any issues. In terms of my last question, regarding the TABLE object (I'm afraid I > don't know a better term for it), if you look here: > https://gist.github.com/dhoss/539650094085c2ef152acab6d5884a0d#file-baseservice-java-L24, > you'll see I've got pseudo code attempting to try and fulfill a generic > table object for the query. Normally, instead of TABLE, it would be a > specific table object name generated by jooq, like GALLERY or IMAGE, in my > case. I'm trying to determine what the appropriate generic would be in > lieu of my pseudo code. I've dug into the generated table classes, and > I've found this (apologies for the naming inconsistencies, I have some > refactoring to do): > > public class Galleries extends TableImpl<GalleriesRecord> { > > private static final long serialVersionUID = 1035239683; > > /** > * The reference instance of <code>public.galleries</code> > */ > public static final Galleries GALLERIES = new Galleries(); > > /** > * The class holding records for this type > */ > @Override > public Class<GalleriesRecord> getRecordType() { > return GalleriesRecord.class; > } > // .... > > However, I attempted to make the table object generic several different > types shown here, but none worked. I think I'll try your polymorphic > parameter suggestion here as well, as it seems to make more sense the more > I type, but I'd like your input if you have a better idea. > Aha, I see. You'd have to declare the generic type along the lines of this (simplified): class BaseService<R extends Record, T extends Table<R>> { T table(); } Then, a GalleriesService could be defined as such: class GalleriesService extends BaseService<GalleriesRecord, Galleries> { } Hope this helps getting you in the right direction Lukas -- 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.
