Hello,

First off, I'm sorry for the delay. I realise that this looks like a
pressing issue that caused quite some time to debug. You're right, the
reason for this regression is hidden in UpdatableRecordImpl.store(), where
we applied a couple of fixes in jOOQ 3.4.0, e.g. #3237:
https://github.com/jOOQ/jOOQ/issues/3237

As the issue title reads (and as you've discovered with debugging), this
fix allows for nullable primary keys, which are particularly useful in SQL
Server, for instance. The previous logic did not allow to update records
whose primary key is null.

So, I think the problem is really the fact that the code generator did not
pick up your domain's NOT NULL constraint. Could you please provide me with
the required DDL to produce your table, including all domains? I will add
that to the integration test suite, then.

In the mean time, I have registered an issue for this code generation
problem:
https://github.com/jOOQ/jOOQ/issues/3382

Cheers
Lukas


2014-07-04 17:40 GMT+02:00 <[email protected]>:

> I have finish my debug party to see where is the difference between 3.3.0
> and 3.4.0 ant this is result :
>
> 1) the code generator is the same with some error in nullable and lenght
> on varchar.
>
> 2) the difference is in UpdatableRecordImpl::store0()
>
> [in 3.3.0]
>
> at   // If any primary key value is null or changed, execute an insert
>                 if (getValue(field) == null ||
> getValue0(field).isChanged()) {
>                     executeUpdate = false;
>                     break;
>                 }
>
> becomes in 3.4.0
>
> // If any primary key value is null or changed
>                 if (changed(field) ||
>
>                 // [#3237] or if a NOT NULL primary key value is null, then 
> execute an INSERT
>                    (field.getDataType().nullable() == false && 
> getValue(field) == null)) {
>                     executeUpdate = false;
>                     break;
>                 }
>
>
>
> Le vendredi 4 juillet 2014 17:01:36 UTC+2, [email protected] a écrit :
>
>> I post the DDL of the table and i attache table result
>>
>> /***********************************************************
>> *******************/
>> /****                                Tables
>>  ****/
>> /***********************************************************
>> *******************/
>>
>>
>>
>> CREATE TABLE BUPDATERLINKS (
>>     IDBUPDATERLINKS  IDENT /* IDENT = VARCHAR(22) NOT NULL */,
>>     BULREFPARENT     REFERENCE /* REFERENCE = VARCHAR(22) DEFAULT '-1' */,
>>     BULTYPE          ENTIER /* ENTIER = INTEGER DEFAULT 0 */,
>>     BULREFBYTYPE     REFERENCE /* REFERENCE = VARCHAR(22) DEFAULT '-1' */,
>>     BULDEST          LIB500 /* LIB500 = VARCHAR(500) */,
>>     BULJSON          BLOBTEXT /* BLOBTEXT = BLOB SUB_TYPE 1 SEGMENT SIZE
>> 80 */,
>>     BULSTATE         ENTIER /* ENTIER = INTEGER DEFAULT 0 */,
>>     BULDATEACTION    DATECOMPLETE /* DATECOMPLETE = TIMESTAMP */,
>>     BULACTIF         ENTIER /* ENTIER = INTEGER DEFAULT 0 */,
>>     FTPDATE          DATECOMPLETE2 /* DATECOMPLETE2 = TIMESTAMP DEFAULT
>> 'now' NOT NULL */,
>>     CREATEDATE       DATECOMPLETE2 /* DATECOMPLETE2 = TIMESTAMP DEFAULT
>> 'now' NOT NULL */
>> );
>>
>>
>>
>>
>> /***********************************************************
>> *******************/
>> /****                             Primary Keys
>>   ****/
>> /***********************************************************
>> *******************/
>>
>> ALTER TABLE BUPDATERLINKS ADD CONSTRAINT PK_BUPDATERLINKS PRIMARY KEY
>> (IDBUPDATERLINKS);
>>
>>
>> /***********************************************************
>> *******************/
>> /****                               Triggers
>>   ****/
>> /***********************************************************
>> *******************/
>>
>>
>> SET TERM ^ ;
>>
>>
>>
>> /***********************************************************
>> *******************/
>> /****                         Triggers for tables
>>  ****/
>> /***********************************************************
>> *******************/
>>
>>
>>
>> /* Trigger: BUPDATERLINKS_BI */
>> CREATE OR ALTER TRIGGER BUPDATERLINKS_BI FOR BUPDATERLINKS
>> ACTIVE BEFORE INSERT POSITION 0
>> as
>> begin
>>   IF (NEW.idbupdaterlinks IS NULL) THEN
>>   BEGIN
>>     EXECUTE PROCEDURE SYS_GET_UUID RETURNING_VALUES NEW.idbupdaterlinks;
>>   END
>> end
>> ^
>>
>> Le vendredi 4 juillet 2014 16:49:52 UTC+2, [email protected] a écrit :
>>>
>>> i think the problem is in the mapping of table the definition of my
>>> primary key is :
>>>
>>> IDMYTABLE VARCHAR(22) NOT NULL via a domain
>>>
>>> but field.getDataType().nullable => returns true and field size is 88
>>> ????
>>>
>>>
>>>
>>> Le vendredi 4 juillet 2014 16:15:46 UTC+2, [email protected] a écrit :
>>>>
>>>> I have debug a little bit and it try to do an update (i don't know why
>>>> for moment)
>>>>
>>>> Le vendredi 4 juillet 2014 16:09:07 UTC+2, [email protected] a écrit :
>>>>>
>>>>> Hi,
>>>>>
>>>>> my database is firebird and now when i doing that the insert don't
>>>>> work :
>>>>>
>>>>> record = getDsl().newRecord(MYTABLE);
>>>>> record.setState(0);
>>>>> record.store();
>>>>>
>>>>> no warning, no error but nothing is inserted and i have a primary key
>>>>> on MYTABLE.
>>>>>
>>>>> it works fine on 3.2.2.
>>>>>
>>>>> any sugestions ?
>>>>>
>>>>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to