The value of the exception configuration property in CGLIB

After adding a new backup database, I get an exception:

Caused by: org.hibernate.PropertyAccessException: exception setting property value with CGLIB (set hibernate.cglib.use_reflection_optimizer=false for more info) setter of com.mytest.User.setPrimaryAccount 

In my User class, I have the following fields:

 ... private boolean isPrimaryAccount; public boolean getPrimaryAccount() { return isPrimaryAccount; } public void setPrimaryAccount(boolean primaryAccount) { isPrimaryAccount = primaryAccount; } ... 

And the exception referencing here from the fact that it started to throw an exception?

+4
source share
1 answer

After adding a new backup database

I think you have a nullable column in your database table, and you are using the primitive type boolean (which cannot be set to null) in your constant class. I think it is for this reason that you get this exception.

Hibernate recommends you:

We recommend that you declare the properties of an identifier with the same name on constant classes and that you use a NULL (i.e., non-primitive) type.

Change boolean to Boolean, It may help ...

+7
source

Source: https://habr.com/ru/post/1393807/


All Articles