Hi Greg,

>> What would be the use-case for such interfaces (especially for the
>> tables)? I can add a feature-request when I understand the goal...
>
> We are integrating jOOQ generated classes into an existing codebase,
> and I have a need to pass around record and/or table objects. In order
> to provide mock implementations we would like to pass around
> references to interfaces (like IPost) instead of references to class
> objects (like Post).

I can see how mock interfaces can help with records (mocking getter /
setter behaviour), but how would it help with table objects? Table
objects don't have any methods that are not defined in any org.jooq.*
interfaces...?

Note, also for records, you could use the org.jooq.Record interface
and similar ones:

http://www.jooq.org/javadoc/latest/org/jooq/Record.html
http://www.jooq.org/javadoc/latest/org/jooq/TableRecord.html
http://www.jooq.org/javadoc/latest/org/jooq/UpdatableRecord.html

generated getters / setters are just convenience for calling
Record.getValue() and setValue():

http://www.jooq.org/javadoc/latest/org/jooq/Record.html#getValue%28org.jooq.Field%29
http://www.jooq.org/javadoc/latest/org/jooq/Record.html#setValue%28org.jooq.Field,%20T%29

Maybe that could help?

>> Note that you can already let jOOQ generate "implements" clauses in
>> generated classes, as documented 
>> here:http://www.jooq.org/manual/META/AdvancedConfiguration/
>>
>> Using a custom generator strategy, you can define
>> getJavaClassImplements() for every generated artefact.
>
> This is one of those java things I don't quite understand how to do. I
> can create the .java file with the above mentioned code, but then I am
> a little lost on what to do with it. I'm guessing I need to somehow
> create a jar file, and include that on the classpath when I execute
> jOOQ. Is that correct?

That depends on how you generate code. With maven, it's a bit more
complicated. You'll have to create a proper module. This was recently
discussed and explained with the help of various jOOQ users:
https://groups.google.com/d/topic/jooq-user/o_eN0g6XjyM/discussion

With ant / standalone Java, you just have to compile that class and
make it available on the classpath for code generation. It doesn't
have to be in a .jar file

> Also, it doesn't appear like the getJavaClassImplements is documented
> anywhere. Any help, or examples of what should be implemented would be
> appreciated.

Yes, that is missing, you're right. It should be added, soon

Cheers
Lukas

Reply via email to