We had another problem with sql server and prepared statements, where it
took forever to execute a statement.
Looking at the example from the docs:
create.select().from(BOOK).where(BOOK.ID.equal(5)).and(BOOK.TITLE.equal("Animal
Farm")).fetch();
Is there a way to tell jooq, that for example BOOK.ID is not a prepared
statement param ? The opposite of val() ...
Because of this problem, we switched completely to STATIC_STATEMENTS and
everything works fast (one statement down from several minutes to 3 sec).
Is there a benefit with prepared statements anyway, if you send the same
basically static sql query (without any params) over and over again ... ?
But then we have a problem with the Loader, the source code:
getContext()
.loadInto(table)
.batchAll()
.onDuplicateKeyUpdate()
.loadRecords(records)
.fields(fields)
.execute();
Doesn't work anymore, because it doesn't fill the queries correctly with
the records anymore.
If I remove the onDuplicateKeyUpdate() it works for inserts as expected.
Am I doing it wrong or is there maybe an error in connection with STATIC -
Loader - OnDuplicatedKey - SQL Server ?
Best Regards
-- Benjamin
Am Dienstag, 5. Juli 2016 22:43:41 UTC+2 schrieb Benjamin Lang:
>
> Hello together,
>
> we are currently evaluating Jooq in a prototype context in order
> to find out if we can use it later in production. So far it seems
> pretty nice, with an almost perfect documentation.
>
> We need to support different PostgreSql and Sql Server types.
>
> One problem we could not yet solve, is the following:
>
> We want to insert a batch of 1000 entries into a table. If
> some entries already exist, we want to update some of the fields instead.
>
> We used:
>
> InsertValuesStep insertStep = context.insertInto(Table, SomeFields);
> List<UpdateTableRecord> records = SomeInitialzedRecords();
>
> records.stream().foreach(record -> {
> insertStep.values(record.getField1(), record.getField2()...);
> insertStep.onDuplicateKeyUpdate().set(Field1, record.getField1());
> }
>
> insertStep.execute();
>
> This works for PostgresSql as expected, but in sql server it does insert
> only one row per execution instead of 1000.
> We also tried:
>
> context.batchStore(records).execute();
>
> But this throws the DuplicateKey Exception instead of updating the row
> entry and it seems somewhat slower than the other option under PostgreSql.
>
> Is this the right way to do what we like to achieve or is there something
> better ?
>
> Thanks in advance - Benjamin
>
>
--
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.