Ok. Here is my test case
Code:
public class VerType {
private long id;
private int value;
// version is short!
private short version;
}
and mapping
Code:
<class name="VerType" table="VER_TYPES">
<id name="id" column="ID" type="long" unsaved-value="0">
<generator class="native" />
</id>
<version name="version" type="short" />
<property name="value" type="integer" />
</class>
I loop incrementing value of field 'value' from 0 to Integer.MAX_VALUE
I use
Code:
<property name="hibernate.hbm2ddl.auto">update</property>
so hibernate creates table for me.
Test shows - after Short.MAX_VALUE version field become negative (overflowed) and H2 jdbc driver handles this value correctly, version starts increment again to Short.MAX_VALUE and so on.
I see 2 possible scenario in your test:
1) you generate db schema yourself and set column size to small to handle MAX_VALUE of you version type - just increase column size
2) db schema is generated by hibernate toolset - either your db dialect creates column too small to handle large version values (dialect class fix required) or jdbc driver unable to handle large value (driver bug).
Quote:
I am asking what behavior when the value of version no. is incremented to be larger than the column size.
You got SQLException wrapped in hibernate unchecked exception thats for sure.