Hi Oleg,

There might be some confusion about what "changed" means. In the previous
example, DATE1 is not "changed" when calling record.from(t1), because t1
doesn't contain a DATE1 field. If it did contain a DATE1 field with a NULL
value in it, then the DATE1 column would be "changed" to NULL (if it is a
nullable column).

Does that help, or do you perhaps have a different case in mind?

Cheers,
Lukas

2015-06-05 14:52 GMT+02:00 Oleg Kuznetsov <[email protected]>:

> Hi Lukas,
>
> Please, add the following line in the end:
>
> String sql = sl.update(TABLE1).set(record).getSQL(ParamType.INLINED);
>
> so you can see, that sql string will contain SET statements for all fields 
> (including DATE1), not only changed.
>
>
> Regards,
>
> Oleg
>
>
> On Tue, Apr 7, 2015 at 12:05 PM, Lukas Eder <[email protected]> wrote:
>
>> Hi Oleg,
>>
>> I'm sorry, I'm not quite sure what you mean by this. The following test
>> passes, for instance:
>>
>>     @Test
>>     public void testRecordFrom() throws Exception {
>>         Table1Record record = create.newRecord(TABLE1);
>>         assertFalse(record.changed());
>>
>>         T1 t1 = new T1();
>>         t1.ID1 = 1;
>>         t1.NAME1 = "A";
>>         t1.DUMMY = "X";
>>
>>         record.from(t1);
>>         assertTrue(record.changed());
>>         assertTrue(record.changed(TABLE1.ID1));
>>         assertTrue(record.changed(TABLE1.NAME1));
>>         assertFalse(record.changed(TABLE1.DATE1));
>>         assertEquals(1, (int) record.getValue(TABLE1.ID1));
>>         assertEquals("A", record.getValue(TABLE1.NAME1));
>>         assertNull(record.getValue(TABLE1.DATE1));
>>     }
>>
>>     static class T1 {
>>         Integer ID1;
>>         String NAME1;
>>         String DUMMY;
>>     }
>>
>> Am I perhaps missing something?
>>
>>
>> 2015-04-02 14:22 GMT+02:00 Oleg Kuznetsov <[email protected]>:
>>
>>> Yes, but currently all fields are marked changed, not only intersected.
>>>
>>> On Thu, Apr 2, 2015 at 8:42 AM, Lukas Eder <[email protected]> wrote:
>>>
>>>>
>>>> 2015-04-01 23:59 GMT+02:00 Oleg Kuznetsov <[email protected]>:
>>>>
>>>>> Hello, Lukas,
>>>>>
>>>>> It's great that changed() has been implemented.
>>>>>
>>>>> One more question: if a dto does not have number of fields that record
>>>>> has, will dsl.executeUpdate(record) on the record converted from this dto
>>>>> still generate update for all fields now?
>>>>>
>>>>
>>>> You have to look at it this way: Loading a record from a DTO is one
>>>> step. Generating an update statement from a record is another step. The two
>>>> steps are completely independent.
>>>>
>>>> When you load a record from a DTO, all the fields that are present in
>>>> both record and DTO will be "changed". If a field is not present in the DTO
>>>> (but in the Record), it will be ignored.
>>>>
>>>> When you generate an update statement from a record, all the fields
>>>> that have been changed will be updated.
>>>>
>>>> --
>>>> You received this message because you are subscribed to a topic in the
>>>> Google Groups "jOOQ User Group" group.
>>>> To unsubscribe from this topic, visit
>>>> https://groups.google.com/d/topic/jooq-user/DIw1KfQaCs0/unsubscribe.
>>>> To unsubscribe from this group and all its topics, 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.
>>>
>>
>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "jOOQ User Group" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/jooq-user/DIw1KfQaCs0/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.
>

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