Question

After attaching newly backuped database, I'm getting 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 these fields:

...

    private boolean isPrimaryAccount;

    public boolean getPrimaryAccount() {
        return isPrimaryAccount;
    }

    public void setPrimaryAccount(boolean primaryAccount) {
        isPrimaryAccount = primaryAccount;
    }

...

And exception referencing to here, from what it started giving an exception?

Was it helpful?

Solution

After attaching newly backuped database

I think, you have nullable column in your database table and you are using primitve type boolean( which cannot be set to null) in your persistent class. I think this is the reason why you are getting this exception.

Hibernate recommends you:

We recommend that you declare consistently-named identifier properties on persistent classes and that you use a nullable (i.e., non-primitive) type.

Change boolean into Boolean, This may help...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top