Java Hibernate Criteria Average: BigDecimal instead of Double -
hibernate criteria mapping projections.avg("column") double.
how can force hibernate map function bigdecimal?
hibernate hibernate-core-4.1.9.final.jar
should possible subclass avgprojection
override gettypes
return bigdecimal , use projection instead.
i.e.
public class avgbdprojection extends avgprojection{ public avgbdprojection(string propertyname) { super(propertyname); } public type[] gettypes(criteria criteria, criteriaquery criteriaquery) throws hibernateexception { return new type[] { org.hibernate.type.bigdecimaltype.instance }; } }
Comments
Post a Comment