<formula> tag always inserts NULL in the database (MS SQL) even when a value is entered.
when this <formula> tag is changed to <column> it will insert the given value but in this case when the field is left blank it doesnt enter NULL and hence doesnt store the record in the DB.
Hibernate version: 3.1
Mapping documents:
user.hbm.xml
Code:
<property name="userId" formula="user_id"/>
Code:
public class User{
private Integer userId;
public User(){
}
public Integer getUserId(){
return userId;
}
public void setUserId(Integer userId){
this.userId = userId;
}
}