Why do I get a “Null value was assigned to a property of primitive type setter of” error message when using HibernateCriteriaBuilder in Grails

后端 未结 12 680
长情又很酷
长情又很酷 2021-01-30 07:58

I get the following error when using a primitive attribute in my grails domain object:

Null value was assigned to a property of primitive type setter of MyDomain         


        
12条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 08:42

    Either fully avoid null in DB via NOT NULL and in Hibernate entity via @Column(nullable = false) accordingly or use Long wrapper instead of you long primitives.

    A primitive is not an Object, therefore u can't assign null to it.

提交回复
热议问题