Skip to content
Advertisement

Boolean values are not mapping properly when using multiset in JOOQ

The ProductCategoryDto class :

CategoryAttribute class :

The query with needs to be executed is

The output for the query is

Database create statements:

Code generation configuration in pom.xml:

I am getting all the boolean fields as null while they are not null in Actual data. How to map the boolean fields properly so that there will be no null values in boolean fields when using multiset

Advertisement

Answer

That’s a bug, which should be fixed, soon, in jOOQ 3.17.0, 3.16.5, 3.15.9: https://github.com/jOOQ/jOOQ/issues/13089

It is related to jOOQ not serialising BIT(1) values correctly when using the SQL/JSON MULTISET emulation. Things would look better if you had used TINYINT instead of BIT(1) to encode your boolean values. Note also that future versions of jOOQ might fix their understanding of the BIT type, which is more of a java.lang.BitSet than a java.lang.Boolean: https://github.com/jOOQ/jOOQ/issues/10323

While you cannot currently influence the SQL/JSON emulation, you could cast your BIT columns to BOOLEAN explicitly, as such: CATEGORY_ATTRIBUTE.NULLABLE.cast(SQLDataType.BOOLEAN)

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement