Reputation: 2422
Hey guys I know when we are retrieving an integer column from a table in Hibernate the return type is BigDecimal and we specify our type using <return-scalar column='salary' type='java.lang.Integer'>
in the hbm.xml file.But now I am using annotations and there is no hbm.xml file, so now how can I specify this
<return-scalar/>
using annotations in Entity Class.
Upvotes: 1
Views: 807
Reputation: 410
To return a scalar we have a work around like this
@Entity
@NamedNativeQueries({
@NamedNativeQuery(name=”COUNT_QUERY”, resultClass = CountDTO.class)})
public class CountDTO {
@Id
@Column(name = “COUNT”)
private Long count;
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
}
Upvotes: 2