There is a boolean field in Entity :
@Column(name = "FREEFLAG", columnDefinition = "NUMBER(0,1) default 0", nullable = false)
public boolean getFreeflag() {
return freeflag;
}
database - Oracle, field FREEFLAG - NUMBER(0,1)
I try to get object from db with Hibernate, but if the field in db is null i got a exception :
Exception in thread "main" org.hibernate.PropertyAccessException: Null value was assigned to a property of primitive type
Why default value doesn't work ? How I can resolve this problem on server side? I have to have 0 or 1 value in db.
I got the solution - Default value not working in hibernate. But I still have to modify database. I have added DDL - alter table client modify freeflag default 0 not null DML - update client set freeflag = 0 where freeflag is null; commit