<generate> ...... <pojos>true</pojos>
<pojos-extends-class>org.openswing.swing.message.receive.java.ValueObjectImpl</pojos-extends-class>
......
</generate>
Better way if adding the complete <pojo-extends-class> as xx.yy.ZZ, the generator calls the import directive in java class and simply use ZZ in extends definition, as written in code example.
Sorry for my bad english, hope i was clear, if not tell me your trouble.
Thank you again for your fantastic work!
Best regards,
Agharta
> Could i tell you if there is a way to pass a "extends" code to generated
> pojos into code generator??
This makes perfect sense and it has been suggested before by Sander:
https://groups.google.com/d/topic/jooq-user/YuTp9-5K9fs/discussion
I'll file this as feature request #1243:
https://sourceforge.net/apps/trac/jooq/ticket/1243
I'm not quite sure about the implementation details, though. Ideally,
jOOQ-codegen would support velocity or XSLT or any other "scripting"
language for arbitrary source code generation, the way minute project
does already:
http://minuteproject.wikispaces.com/JOOQ
That would then allow for much more flexible generated artefacts. But
extending base classes in POJOs is quite a common use case, so I might
add it as you suggested in jooq-codegen.
Cheers
Lukas
> Better way if adding the complete <pojo-extends-class> as xx.yy.ZZ, the
> generator calls the import directive in java class and simply use ZZ in
> extends definition, as written in code example.
I prefer not to import classes in generated artefacts. The risk of
collisions is too high.
Cheers
Lukas
> I've not seen the ticket #1243, sorry for duplicate request.
I've just created that ticket after your e-mail :-)
> Minute project is the best way to implement this feature. As "extends"
> feature, "implements" feature could be done in same way. Your decision. In
> any case you are right, "extends" is the common used feature.
#1243 will somehow support "extends" and "implements". In that
previous discussion with Sander, the point was that many tables have
common columns, such as CREATED_BY, CREATED_AT, MODIFIED_BY,
MODIFIED_AT, etc. Allowing for implementing interfaces might help
abstracting these fields to a higher level:
--------------------------------------------------------
public interface DatabaseObject {
Long getId();
String getCreatedBy();
Timestamp getCreatedAt();
String getModifiedBy();
Timestamp getModifiedAt();
}
--------------------------------------------------------
With an API like this, generic DAO classes can be written easily. So
it makes perfect sense for jOOQ-generated POJOs to implement custom
interfaces, as well as to extend custom classes.
Cheers
Lukas
Ticket #1243 is implemented on SVN trunk and will be included in the
next snapshots:
https://sourceforge.net/apps/trac/jooq/ticket/1243
I decided to add this feature to the GeneratorStrategy, rather than
adding more XML configuration elements. I think this is the best
place, as people wanting to customise artefacts on that level will
probably have a custom GeneratorStrategy anyway (e.g. to add a "Pojo"
suffix to POJO classes).
This feature will be documented when I release jOOQ 2.2.0
Cheers
Lukas