Jooq 3.7.1 Cannot remove serialization on generated POJOs

Visto 56 veces
Saltar al primer mensaje no leído

amirul...@gmail.com

no leída,
1 ene 2016, 10:06:181/1/16
a jOOQ User Group
Hi there guys (and Happy New Year!),

As per the topic title, I'm using a generator strategy which implements this 

@Override
List<String> getJavaClassImplements(Definition definition, GeneratorStrategy.Mode mode) {
   
if (mode.equals(org.jooq.util.GeneratorStrategy.Mode.POJO)) {
       
//remove serialization implement
        return null;
   
} else
        return super.getJavaClassImpleme

Other overrides in the strategy works. Overriding as the code above however does not even generate the POJOs at all (POJO generation without this override does works beautifully). 

I'm currently using Gradle 2.8 with org.jooq:jooq-codegen:3.7.1  dependencies.

As for my reason to remove the Serializable interface: I wanted to share the same generated pojos inside Android which prefers to implement the Parcelable serialization interface instead (as Serializable on Android is very slow and generally not recommended).

Hence, may I know is this a bug or expected behavior? 

Lukas Eder

no leída,
1 ene 2016, 10:46:431/1/16
a jooq...@googlegroups.com
Hi there and Happy New Year to you too!

Thanks for your feedback. Curiously, Serializable cannot be opted out from, even if I perfectly understand your use-case. We'll fix this in a future release:

Right now, I suspect you'll need to patch org.jooq.util.GeneratorStrategyWrapper.getJavaClassImplements() and remove the relevant logic. Another option is to use a post-processing Maven or Gradle plugin, using which patch the generated code by removing "implements Serializable". E.g. by using the maven-replacer-plugin:

Hope this helps.
Best Regards,
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 jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lukas Eder

no leída,
20 feb 2018, 7:29:3120/2/18
a jOOQ User Group
These issues are now implemented for jOOQ 3.11:

https://github.com/jOOQ/jOOQ/issues/4888 (Add <serializablePojos/> to allow for POJOs not to be Serializable)
https://github.com/jOOQ/jOOQ/issues/7210 (Add <serializableInterfaces/> to allow for interfaces not to be Serializable)
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+unsubscribe@googlegroups.com.
Responder a todos
Responder al autor
Reenviar
0 mensajes nuevos