Jooq: Invalid insert from generated dataclass & dao

Created on 9 Nov 2020  路  4Comments  路  Source: jOOQ/jOOQ

Expected behavior

Should insert values set on generated pojo/dataclass.

Actual behavior

Miss several values

Steps to reproduce the problem

Use the maven plugin to generate pojos and daos.

@Suppress("UNCHECKED_CAST")
@Entity
@Table(
    name = "T_DHUBFILESEQ",
    schema = "APPDATA",
    uniqueConstraints = [
        UniqueConstraint(name = "PK_T_DHUBFILESEQ", columnNames = [ "BANK_ID", "TABLENAME" ])
    ]
)
data class TDhubfileseq(
      var fileSeqno: BigDecimal? = null
    , var bankId: String? = null
    , var tablename: String? = null
    , var version: BigDecimal? = null
    , var createdDt: LocalDateTime? = null
    , var updatedDt: LocalDateTime? = null
): Serializable {

}
 tDhubfileseq = TDhubfileseq(
                fileSeqno = BigDecimal.ONE,
                createdDt = LocalDateTime.now(),
                updatedDt = LocalDateTime.now(),
                version = BigDecimal.ONE,
                bankId = "9999",
                tablename = "somename")
            tDhubfileseqDao.insert(tDhubfileseq)
For some reason it ignores several fields:
2020-11-09 22:26:46,433 [main][][][][][][][] DEBUG org.jooq.tools.LoggerListener - -> with bind values      : 
insert into "T_DHUBFILESEQ" (
  "CREATED_DT",
  "VERSION",
  "UPDATED_DT"
)
values (
  timestamp '2020-11-09 22:26:39.154098', 
  1, 
  timestamp '2020-11-09 22:26:46.431'
)

org.jooq.exception.DataAccessException: SQL [insert into "T_DHUBFILESEQ" (
  "CREATED_DT",
  "VERSION",
  "UPDATED_DT"
)
values (
  ?, 
  ?, 
  ?
)]; ORA-01400: cannot insert NULL into ("APPDATA"."T_DHUBFILESEQ"."FILE_SEQNO")

Versions

  • jOOQ: 3.14.2
  • Java: 15
  • Database (include vendor): oracle
  • OS: N/A
  • JDBC Driver (include name if inofficial driver): latest ojdbc
C Kotlin All Editions High Duplicate Defect

All 4 comments

Thank you very much for your report. I think this is a consequence of https://github.com/jOOQ/jOOQ/issues/10783. Can you confirm that things work correctly if you remove <jpaAnnotations/>?

Yes it does.

Thanks for the confirmation. Closing this as a duplicate of #10783. Will fix the latter soon!

I can confirm this issue here. https://github.com/jOOQ/jOOQ/issues/10783 fixes it.

The next 3.14.4-SNAPSHOT version will include the fix: https://www.jooq.org/download/versions

Was this page helpful?
0 / 5 - 0 ratings