Tuesday, July 7, 2009

Add default value to column in hibernate

private boolean invalid=false;

@Column(name="INVALID", columnDefinition = "BIT(1) default 0")
public boolean isInvalid() {
return invalid;
}
public void setInvalid(boolean invalid) {
this.invalid = invalid;
}

Should work for mysql only.

2 comments:

Anonymous said...

how does hibernate work if you have a query containing joins from 4 tables followed by other where clauses and order by, group by clauses?

Arpan Solanki said...

are you looking for examples on how to do it, or you are want to know if the are any performance issues?