Hi Lukas, On Mon, Dec 17, 2012 at 5:11 PM, Lukas Eder <[email protected]> wrote:
> > The best way to do so that, which I can think of right now, is to > specify marker interfaces to be implemented by tables with an ENDPOINT > column. Details can be seen in this section of the manual (better > examples will be provided after some jOOQ 3.0 improvements in that > area): > http://www.jooq.org/doc/2.6/manual/code-generation/codegen-advanced/ > > Essentially, you should override the following method in your custom > generator strategy implementation: > public List<String> getJavaClassImplements(Definition definition, Mode > mode); > > I'm guessing that once you've added such an interface (e.g. > "EndpointTable") to the relevant tables, you can do something like > this: > def deleteRecordsInSpace[R <: Record, T <: Table[R] with > EndpointTable](t: Factory, space: Long, table: T) = { > > Currently, letting generated Table classes extend a custom base class > is not possible. This means that you would have to modify the > generator if your EndpointTable contained any methods. In jOOQ 3.0, it > should be easier to extend the standard code generator for such use > cases. > Well that's certainly a very good start and the interface gives us pretty much what we need for now - a type checkable way of applying a generic routine to a bunch of similarly structured tables. I can see your point about being able to extend base classes - being able to mould and sculpt your SQL whilst retaining factoring, compile time checks and clarity is very powerful thing, which requires careful design :-) Thanks for the heads up, Cheers, Ben
