After upgrading from version 3.10 to 3.12 we noticed that we had some 
problem with the new JSON datatypes. Specifically we were seeing:

java.io.NotSerializableException: org.jooq.JSONB


We we use REDIS caching with all our queries in the form of a 
MockDataProvider

public class CachedDataProvider implements MockDataProvider 

The exception above is throw when we try to serialize the *ResultSet*


private MockResult[] cacheResult(byte[] key, Result<?> result) {
 try {
      cache.set(key, serializeResult(result), helper.getTTL());
 } catch (Exception e) {
      logger.error("Failed to cache SQL result", e);
 }
 return mockResult(result);
 }



private byte[] serializeResult(Result<?> object) {
 try (ByteArrayOutputStream byteStream = new ByteArrayOutputStream()) {
       ObjectOutputStream objectStream = new ObjectOutputStream(byteStream); 
  
       objectStream.writeObject(object);
       objectStream.flush();
 return byteStream.toByteArray();
 } catch (IOException ex) {
 logger.error("Error while serializing Result", ex);
 }
 return null;
 }

Enter code here...


Trying to serialize the Result using objectStream.writeObject(object*); * is 
where the exception is thrown.

Any advice on how to handle this? The only solution that comes to mind is 
extending JOOQ's JSONB class and implementing serializable.







-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/553b6fac-dfb3-4960-afa4-c710fd4733d7%40googlegroups.com.

Reply via email to