Hi forum,
When I use big decimal values I can't find record into database... but if I use float objects works...
hibernate
3.2.6.gahibernate-annotations
3.3.1.GAhibernate-commons-annotations
3.3.0.gahibernate-validator
3.0.0.gaOracle XE with Oracle10gDialect or OracleDialect...
Code:
@Column(name = "salary", nullable = true, precision = 8, scale = 2, columnDefinition="NUMBER(8,2)")
private BigDecimal salary;
Code:
Employee employee = new Employee();
employee.setId(3);
employee.setSalary(new BigDecimal(10.19));
employeeDAO.put(employee); // save object
List<Employee> res = employeeDAO.findByExample(employee); // object not found
Code:
@SuppressWarnings("unchecked")
public List<T> findByExample(final T example) {
return getHibernateTemplate().executeFind(new HibernateCallback() {
public Object doInHibernate(Session session)
throws HibernateException, SQLException {
Criteria c = session.createCriteria(clazz);
c.add(Example.create(example).enableLike(MatchMode.ANYWHERE).ignoreCase());
return c.list();
}
});
}
Thanks very much for any thoughts or comments,
Lucas