This is the code I have come up with (the variable *user* holds the POJO 
with the request data):

      final Record inputRec = sql.newRecord(USER);
      inputRec.from(user);
      final List<Field<?>> fields = new ArrayList<>();
      final List<Object> values = new ArrayList<>();
      for (Field<?> f : inputRec.fields()) {
          final Object v = inputRec.getValue(f);
          if (v != null) { fields.add(f); values.add(v); }
      }
      sql.insertInto(u, fields).values(values).execute();

Please let me know if there's a cleaner/shorter approach.

-- Marko 

-- 
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