One way to "know" this is to see if your primary key value is null or if it
is set. This works well if you're using an IDENTITY / AUTO_INCREMENT
column, as jOOQ will fetch that value from the database after store().

Note that you might not need to know this if you're calling
UpdatableRecord.store().

Does that answer your question?

Happy Easter,
Lukas

2014-04-18 18:24 GMT+02:00 Estevão Freitas <[email protected]>:

> But how can I know when a record is new or restored from database?
> Em 16/04/2014 11:24, "Lukas Eder" <[email protected]> escreveu:
>
>>
>> 2014-04-16 16:09 GMT+02:00 Estevão Freitas <[email protected]>:
>>
>>> In Hibernate and JPA we can use a flag called "deleteOrphans", so when
>>> those frameworks load collections, we use this flag to delete or not
>>> removed elements from collections.
>>>
>>> I tried to code something like that, but I can't identity when a list
>>> element was retrieved from database or was just created.
>>>
>>
>> Yes, for such a thing to work, a second-level cache would be useful, of
>> course. We expressly want to avoid implementing such a cache as
>> Hibernate/JPA already do a pretty good job when it comes to object-graph
>> persistence.
>>
>> --
>> 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.
>

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