简体   繁体   中英

Setting NULL value in UPDATE query of Native JPA in Spring data

Whenever my primaryGrpId comes as null the following native query is failing with SQLGrammerException, because it is expecting NUMBER. Andy idea how to set NULL if parameter value is null with native query in JPA. The database is ORACLE.

@Modifying
@Query(nativeQuery = true, value = "update EVENT set PRIMARY_CATEGORY_ID=?2, PRIMARY_GROUPING_ID=?3 where PRIMARY_PERFORMER_ID=?1")
  void updatePrimaryCatGrpOfEntities(Long primaryPerfId, Long primaryCatId, Long primaryGrpId);

Caused by: java.sql.SQLSyntaxErrorException: ORA-00932: inconsistent datatypes: expected NUMBER got BINARY

All my DAO methods are just declared, no implementation is provided to write something like "setParameter"....etc.

在此处输入图片说明

检查列定义是否允许为null。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM