Can we find the cause of the issue I am facing pls? I have not shown
populateFieldMap(). In this method, I am creating an instance of
Map<Field<?>, Object>. In this instance, I am populating the table values
I want to add. I already said in the comment, if I print this instance,
the output would be: {"BIGINTcol"=hello, "INTEGERcol"=22, "SMALLINTcol"=33}
I wouldn't worry about BatchExecuteListener or DSL.name().
My concern is why non-integer values are converted into null by JOOQ? How
to tame JOOQ not to do that conversion.
On Tuesday, July 9, 2019 at 9:21:08 PM UTC+5:30, Lukas Eder wrote:
>
> Hi there,
>
> Thank you very much for your patience.
>
> I have a few questions / remarks:
>
> 1. What's the purpose of your BatchExecuteListener? Anything that you
> think we should improve in jOOQ directly?
> 2. Your code example is incomplete. What's in populateFieldMap?
> 3. You don't need to roll your own "quoteIdentifier()" method. Just use
> jOOQ's DSL.name()
>
> On Wed, Jul 3, 2019 at 7:47 AM <[email protected] <javascript:>>
> wrote:
>
>> Yes sir, the code is as follows:
>>
>> public class BatchExecuteListener extends DefaultExecuteListener {
>> private static final Logger log =
>> LoggerFactory.getLogger(BatchExecuteListener.class);
>>
>> @Override
>> public void executeEnd(ExecuteContext ctx) {
>> try {
>> ctx.statement().clearBatch();
>> } catch (SQLException e) {
>> log.warn(CLEAR_BATCH_FAILED);
>> }
>> }
>> }
>>
>> public static void main(String args[]) {
>> Connection conn = getJdbcConnection();
>> Settings settings = new Settings()
>> .withRenderNameStyle(RenderNameStyle.QUOTED);
>> DSLContext context = DSL.using(conn, SQLDialect.MYSQL, settings);
>> context.configuration()
>> .set(new DefaultExecuteListenerProvider(new
>> BatchExecuteListener()));
>>
>> Map<Field<?>, Object> fieldMap = populateFieldMap();
>>
>> // If we print fieldMap, its as follows: {"BIGINTcol"=hello,
>> "INTEGERcol"=22, "SMALLINTcol"=33}
>> Query query = context.insertInto(DSL.table(quoteIdentifier(tableName)),
>> fieldMap.keySet()).values(fieldMap.values());
>> Batch batch = context.batch(query);
>> ((BatchBindStep) batch).bind(fieldMap.values().toArray());
>> batch.execute();
>> }
>>
>>
>> On Tuesday, July 2, 2019 at 7:01:48 PM UTC+5:30, Lukas Eder wrote:
>>>
>>> Hello,
>>>
>>> Thanks for your message. Would you mind showing your jOOQ code?
>>>
>>> Cheers,
>>> Lukas
>>>
>>> On Tue, Jul 2, 2019 at 3:25 PM <[email protected]> wrote:
>>>
>>>> Hi Guys,
>>>> I am using JOOQ library in my Java project to perform JDBC-based
>>>> integrations with various databases. For MySQL, I have a table defined as
>>>> follows:
>>>> CREATE TABLE T1 (C1 smallint, C2 int, C3 biging);
>>>>
>>>> And I am trying to insert the values ("someString", 2, 3) into T1.
>>>> Instead of getting error, I am surprised that the query executed
>>>> successfully and JOOQ converted "someString" into a NULL value.
>>>>
>>>> Is there a way to configure JOOQ not to convert invalid values into
>>>> NULL and rather throw an error?
>>>>
>>>> --
>>>> 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/d0f974e2-b922-49b3-866c-db6c915e8fb5%40googlegroups.com
>>>>
>>>> <https://groups.google.com/d/msgid/jooq-user/d0f974e2-b922-49b3-866c-db6c915e8fb5%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>> 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] <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/jooq-user/7bb2260d-97c2-4bb8-a3d1-e1e47da319bd%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/jooq-user/7bb2260d-97c2-4bb8-a3d1-e1e47da319bd%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> 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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jooq-user/22ec072e-b71b-4594-b76e-1a43e2b10c1a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.