Replace this:

syntheticPrimaryKeys = 'SCHEMA\.TABLE\.COLUMN(1)'


By a meaningful regular expression, such as

syntheticPrimaryKeys = 'public\.subject_page\.id'


On Mon, Mar 2, 2020 at 8:56 PM Debapriya Patra <[email protected]>
wrote:

> Hi Lukas,
>
> I am kinda confused and wanted to make sure I understand the whole thing
> about synthetic primary keys and implement properly.
>
> I am attaching my groovy file which is used int eh gradle file as. Jooq
> code generator. Also my schema definition file as well.
> Can you please help me understand what changes I have to do here to make
> it work in my case ?
>
>
> Cheers,
> Debapriya Patra
> 650.933.6852
>
>
> On Mon, Mar 2, 2020 at 1:16 AM Lukas Eder <[email protected]> wrote:
>
>> Hi Deba,
>>
>> The primary key meta information is required to emulate ON DUPLICATE KEY
>> UPDATE on PostgreSQL.
>>
>> jOOQ does not (yet) know the underlying primary key(s) of an updatable
>> view. You can tell jOOQ's code generator by specifying "synthetic primary
>> keys", though:
>>
>> https://www.jooq.org/doc/latest/manual/code-generation/codegen-advanced/codegen-config-database/codegen-database-synthetic-primary-keys/
>>
>>
>> This will add primary key information in your generated code, and turn
>> all TableRecords into UpdatableRecords.
>>
>> I hope this helps,
>> Lukas
>>
>> On Mon, Mar 2, 2020 at 4:06 AM Debapriya Patra <[email protected]>
>> wrote:
>>
>>> In my case the PrimaryKey is generated by the DB, which is a UUID. So to
>>> avoid this error because PrimaryKey will be null and this error is because
>>> of that I believe.
>>>
>>> Thanks,
>>> Deba
>>>
>>> On Thursday, February 27, 2020 at 12:43:35 PM UTC-8, Debapriya Patra
>>> wrote:
>>>>
>>>> Hi Lukas,
>>>>
>>>> I am designing a DB where I have the columns below.
>>>>
>>>> [image: Screen Shot 2020-02-27 at 12.34.51 PM.png]
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> There is a nightly build which is basically pulling data from another
>>>> system and entering records to this DB. I am doing a batch insert of
>>>> records.
>>>>
>>>> public boolean createTopicPages(List<TopicPage> topicPages) {
>>>>     List<TopicPageRecord> topicPageRecords = new 
>>>> ArrayList<>(topicPages.size());
>>>>     topicPages.stream().forEach(topicPage -> {
>>>>         TopicPageRecord topicPageRecord = new TopicPageRecord();
>>>>         topicPageRecord.setTaxonomyId(topicPage.getTaxonomyId());
>>>>         topicPageRecord.setCmsName(topicPage.getCmsName());
>>>>         topicPageRecord.setSubject(topicPage.getSubject());
>>>>         topicPageRecord.setClassification(topicPage.getClassification());
>>>>         topicPageRecord.setEntryName(topicPage.getEntryName());
>>>>         topicPageRecord.setStatus(topicPage.getStatus());
>>>>         topicPageRecord.setEntryUpdated(topicPage.getEntryUpdated());
>>>>         topicPageRecord.setEntryPublished(topicPage.getEntryPublished());
>>>>         topicPageRecords.add(topicPageRecord);
>>>>     });
>>>>     int[] execute = dsl.batchInsert(topicPageRecords).execute();
>>>>     return execute.length > 0;
>>>> }
>>>>
>>>>
>>>> Now the problem is, when every time pull records and trying to insert
>>>> into the DB , there will be exiting entries already in the DB. I wanted to
>>>> either ignore or update the existing records.
>>>> If there is a change to either *entry_updated OR status * for any of
>>>> the existing records in DB then I wanted to update that record with the new
>>>> status and entry_updated value. Otherwise ignore those existing records and
>>>> just insert the new ones.
>>>>
>>>> In my DB* cms_name, taxonomy_id & subject* are unique columns.
>>>>
>>>> Can you please let me know how will I solve this problem using Jooq
>>>> query ? I was reading lot of blogs where people are talking about
>>>> *upsert* solutions which you have provided but in my case its a batch
>>>> insert I am doing so in that case how Jooq will help me here.
>>>>
>>>> NOTE: I use Postgres DB for my application.
>>>>
>>>> Thanks,
>>>> Deba
>>>>
>>> --
>>> 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].
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/jooq-user/5b15619b-8937-43d5-a52d-55d0b4caf651%40googlegroups.com
>>> <https://groups.google.com/d/msgid/jooq-user/5b15619b-8937-43d5-a52d-55d0b4caf651%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
>> 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].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jooq-user/CAB4ELO6zGY9HTckY1yPRfCnUupXsnZ61HicgPsOfSumnj%2Bhi1Q%40mail.gmail.com
>> <https://groups.google.com/d/msgid/jooq-user/CAB4ELO6zGY9HTckY1yPRfCnUupXsnZ61HicgPsOfSumnj%2Bhi1Q%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jooq-user/CAM2NkrQ9U1oHoXbBgtn7roF%2BBrbLUGedahQtEH01vYgwXJjEaw%40mail.gmail.com
> <https://groups.google.com/d/msgid/jooq-user/CAM2NkrQ9U1oHoXbBgtn7roF%2BBrbLUGedahQtEH01vYgwXJjEaw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jooq-user/CAB4ELO4xzp%2BfYMcrhs1SWLBWMDoFVFppqL%2BmU2FYH3%3D3L4_TRg%40mail.gmail.com.

Reply via email to