I am using Hibernate with JPA annotations on my POJO's and was until recently having trouble getting Hibernate to recognize the money type reported by MS SQLServer 2005. The only way I could figure out how to do this was to extend the SQLServerDialect in order to support the type as follows:
/*
* Custom class extending SQLServerDialect to recognize money data type
*/
public class MyDialect extends SQLServerDialect {
public MyDialect() {
super();
registerColumnType( Types.NUMERIC, "money" ); // Overwrite SQL Server datatype NUMERIC
}
}
and configure Hibernate to use it instead of SQLServerDialect. Is there a more elegant way to achieve the same result in either the Hibernate configuration or using JPA annotations on the attribute? If there is a way to do this using hbm.xml mappings, I would like to hear about it also.
Thanks for any help,
Bernard
|