The presence of a long field for an object controlled by sleep mode can be dangerous with zero values. When Hibernate tries to set zero to a primitive, an exception will be thrown.
The best solution should be to use Long instead of long, so null can be assigned to Long field.
But I am working on a project where we cannot use Long or Integer. I am wondering if there is a way to override hibernation types to use the nullSafe method or something like that.
source share