【发布时间】:2016-08-30 10:49:00
【问题描述】:
我的表中有一个字段定义为:
"SECTION" NUMBER(3,0)
该字段的hbm映射为:
<property name="section" type="integer">
<column name="SECTION" />
</property>
在实体类中我声明为:
private Integer section;
在我的 DAO 中,在插入数据之前,如果我获得的数据对于 section 字段来说太大,我想验证并抛出异常。
到目前为止,我使用从我的应用程序上下文中获得的 LocalSessionFactoryBean:
int length = ((Column) localSessionFactoryBean.
getConfiguration().
getClassMapping(MyEntity.class.getName()).
getProperty("section").
getColumnIterator().next()).getLength();
问题在于,对于声明为整数的每个字段,长度始终为 255。
如何获取 oracle 中定义的列长度? (这里:数字(3,0))
【问题讨论】:
标签: java spring oracle hibernate sessionfactory