Given this class mapped with JPA (using JPA 1.0 and Hibernate):
@Entity
public class Foo {
private int bar;
/* ... */
}
BAR
column set to NULL?bar
field when the corresponding column is NULL?Notes
I know this is not a best practice. The question is more out of curiosity and it is inspired by this situation:
NOT NULL
constraint is impractical. Bad data is expected, and the point of my code is to validate, clean up and/or reject data before loading it into the "real" database.boolean
flag which should default to false
.2.
@Column(name = “bar”, nullable = false, columnDefinition = “bigint(20) default 0″)
private int bar;
it solves your problem.