All,
I wrote a hibernate interceptor for converting all strings into upper case as shown below. It works well in general except for one case where it is throwing a stalestateexception. for now i created a condition to check for xxx class which is where i am having a problem as a work around. Wondering if you have seen this before and shed some light.
thanks,
Code:
public boolean onSave(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types) {
convertProperties(entity, state, propertyNames, types);
return super.onSave(entity, id, state, propertyNames, types);
}
private void convertProperties(Object entity, Object[] currentState, String[] propertyNames, Type[] types) {
if (!(entity instanceof XXX))
{
for (int i = 0; i < currentState.length; i++) {
if (currentState[i] instanceof String && currentState[i] != null) {
currentState[i] = ((String) currentState[i]).toUpperCase();
}
}
}
}