I have a field in my table defined as:
"SECTION" NUMBER(3,0)
The hbm mapping for this field is:
<property name="section" type="integer">
<column name="SECTION" />
</property>
In the entity class I declare it as:
private Integer section;
In my DAO, before inserting the data, I'd like to validate and throw an exception if the data I get is too large for the section field.
What I have so far using the LocalSessionFactoryBean that I get from my application context:
int length = ((Column) localSessionFactoryBean.
getConfiguration().
getClassMapping(MyEntity.class.getName()).
getProperty("section").
getColumnIterator().next()).getLength();
The problem is that for each field declared as integer, the length is always 255.
How can I get the column length defined in oracle? (here: number(3,0))
Maybe, instead of trying to access the column definition, just use Hibernate Validator on your POJO?