PostgreSQL JDBC Null String taken as a bytea

后端 未结 9 588
后悔当初
后悔当初 2020-12-10 02:59

If entity.getHistory() is null following code snippet:

(getEntityManager() returns spring injected EntityManager, database field history type is: text or varchar2(20

9条回答
  •  执笔经年
    2020-12-10 03:31

    There's a simple fix: when you're building the query string, if a parameter is going to be null -- use "null" instead of "?".

    As @araqnid says, Hibernate is incorrectly casting null values into type bytea because it doesn't know any better.

提交回复
热议问题