随笔-9  评论-168  文章-266  trackbacks-0
oracle 数据库:
hibernate annotation :
@column(name="numbers",columndefinition="number(20,3) default 0 ")
public bigdecimal getnumbers() {
return numbers;
}

异常:
caused by: org.hibernate.hibernateexception: wrong column type: numbers, expected: number(20,3) default 0 
at org.hibernate.mapping.table.validatecolumns(table.java:261)
at org.hibernate.cfg.configuration.validateschema(configuration.java:1083)
at org.hibernate.tool.hbm2ddl.schemavalidator.validate(schemavalidator.java:116)
at org.hibernate.impl.sessionfactoryimpl.(sessionfactoryimpl.java:317)
at org.hibernate.cfg.configuration.buildsessionfactory(configuration.java:1294)
at org.hibernate.cfg.annotationconfiguration.buildsessionfactory(annotationconfiguration.java:915)
at org.hibernate.ejb.ejb3configuration.buildentitymanagerfactory(ejb3configuration.java:730)
... 122 more
解决方法:
@column(name="numbers",columndefinition="number(20,3) default 0 ")
public bigdecimal getnumbers() {
return numbers;
}
原因:hibernate 在列定义选项中,数据库中的所有类型应为小写number. hibernate在此直接面对数据库,所以区分大小写.
posted on 2011-12-05 09:21 紫蝶∏飛揚↗ 阅读(10170) 评论(1)  编辑  收藏 所属分类: hibernate数据库

评论:
# re: hibernate 注解映射 设置默认值的异常及解决方法 2013-09-25 16:26 |
四谛法  回复  
  
网站地图