Let's say I'd be happy to treat each null field in the POJO as missing. 
What would be the least painful way to formulate such a Record from the 
POJO? Perhaps build a Map<String,Object> from the POJO using some custom 
code which skips nulls?

On Wednesday, October 16, 2013 9:07:27 PM UTC+2, Marko Topolnik wrote:
>
> I'm using a JOOQ-generated POJO as the receiver of JSON data coming from a 
> REST request. This is a simple CRUD request, specifically Create. For a 
> number of columns I have default values defined in the database schema and, 
> naturally, the primary key is generated at the database end. However, the 
> POJO has all these properties, which end up being null, indistinguishable 
> from "Undefined" in Java. Then I convert the POJO into a JOOQ Record and 
> try to insert, which fails with NOT NULL constraint violation.
>
> What would be my options to get this right, with as little boilerplate as 
> possible? These are the constraints:
>
> 1) if I use a simple Map to receive the request data, then I don't benefit 
> from the automatic conversions which the JSON mapper does for me (e.g., I 
> have a byte[] column, seamlessy transferred as Base64-encoded string);
>
> 2) if I use the POJO, I really have no automatic way to distinguish null 
> fields from undefined (missing) ones.
>
>
> Thanks,
>
> Marko Topolnik
>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to