Hi Peter

The reason is simple. If you don't set a column value, you'd expect the
outcome to contain the DDL DEFAULT for that value. If you do set a value,
you want it to be precisely that. While for the primary key, this seems to
be a bit weird when NULL is set, it still makes sense as a general rule

Cheers
Lukas


2013/3/12 Peter Cooner <[email protected]>

> I've not had time to reproduce this - but maybe its easy.
>
> What I observed was this:
>
> ARecord a = new ARecord();
> a.setId(null);
> a.setOthers(other);
> ....
> a.attach(create);
> a.insert();
>
> And this will fail, complaining that the primary key ID was null. The SQL
> that the insert executed was INSERT INTO A (id, others, ...) VALUES (null,
> other, ...);
>
> Not calling a.setId(null); fixed the problem.
>
> I'm not sure why it tried to insert the id with the null value - wouldn't
> any column that was null be excluded from the generated insert statement?
>
> I thought it was a little odd anyway.
>
> Pete
>
> --
> 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.
>
>
>

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