I need to create restriction on String field.
In an ideal situation - if inserted data length exeed permited length the program should create warning, and cut to permited lenght if user insist.
I try to use length in <property> element, in mapping file, like
Code:
<property name="regCode" type="string" column="reg_code" length="10"/>
it not helps. In db column reg_code got 40 varchar and if I put in program 12 chars - all of them in database.
The only possibility I found - to put into bean file
Code:
public void setRegCode(String regCode) {
this.regCode = regCode.substring(0, 10);
}
But this "method" quite stupid
db - mySQL 5.0.22