Hello,...
I'm defining my own UserType called FixedString and in nullSafeSet method I'd like to fill all string values with blanks (up to length of that column defined with annotation:
@Column(length=100, nullable=true)).
I have no problem to trim all strings in nullSafeGet method (with StringUtils.trim method):
Code:
public Object nullSafeGet(ResultSet inResultSet, String[] names, Object o) throws SQLException {
String val = (String)Hibernate.STRING.nullSafeGet(inResultSet, names[0]);
return StringUtils.trim(val);
}
,but I have no idea how I can get the length of current column (in my case COLUMN_LENGTH).Code:
public void nullSafeSet(PreparedStatement inPreparedStatement, Object o, int i) throws SQLException {
String val = (String)o;
inPreparedStatement.setString(i, StringUtils.rightPad(val, COLUMN_LENGTH)));
}
Could anyone help me with that pls?
I'm open to any idea...
Thanks a lot,
Robbie