Null value in import CSV

19 views
Skip to first unread message

t...@dii.fr

unread,
Aug 20, 2020, 4:18:03 AM8/20/20
to jOOQ User Group
Hello, 
i'm new JOOQ user and during a loadCSV, jooq attemps to insert a null value (my field is numeric and not nullable so i have an exception) , the value for the field in CSV is empty
I tried the nullString parameter without success

CSV (it's the third value) : 
ABJ;NOVA100;
ABJ;PLAS148;       46

the java code: 
ctx.loadInto(Tables.PRODUIT_ETABLISSEMENT)
.onDuplicateKeyUpdate()
.loadCSV(temporaryFileSQL)
.fields(Tables.PRODUIT_ETABLISSEMENT.ETACODE,Tables.PRODUIT_ETABLISSEMENT.PSCODE, Tables.PRODUIT_ETABLISSEMENT.PSSTK)
.ignoreRows(0)
.nullString("{null}")
.quote('\'')
.separator(';')
.execute();


the exception : 
org.jooq.exception.DataAccessException: SQL [insert into `ubipharm02`.`produit_etablissement` (`etacode`, `pscode`, `psstk`) values (?, ?, ?) on duplicate key update `ubipharm02`.`produit_etablissement`.`psstk` = ?]; (conn=249564) Column 'psstk' cannot be null

i don't understand why jooq remplace the empty by null

Thank you 

Lukas Eder

unread,
Aug 21, 2020, 10:40:28 AM8/21/20
to jOOQ User Group
Hello,

Thanks very much for your message. Unfortunately, I couldn't reproduce the problem. When I tried something similar to what you did, I got the expected empty string in the third column on both H2 and MySQL (I'm assuming you're using MySQL because of the backticks). Just to be sure, there isn't any trigger on your PRODUIT_ETABLISSEMENT table, nor any RecordListener, ExecuteListener, Converter, or Binding involved here?

Thanks,
Lukas

--
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 jooq-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jooq-user/80e5e711-2e0e-4e5d-8010-4170a6310d73n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages