I'm sorry. Perhaps I'm just dense, but I've been looking through the documentation, looking at samples in the hibernate junit tests, and am not having much luck seeing a clear path through this. Perhaps it's just my unfamiliarity with the API.
I've tried implementing UserType in a class called MaxLengthStringType with the plan to catch the strings which exceed the max length in the nullSafeSet() method. However, I'm back to my original problem of not being able to cleanly lookup the actual maximum 'length' that's specified in the hibernate mappings.
If I used a ParameterizedType, I would have to specify the length twice in the mapping file, right?
If I use a CompositeUserType, I have access to an additional method which provides a SessionImplementor, but I don't see a clear path to lookup the length attribute of the value which is being set:
Code:
public void nullSafeSet(PreparedStatement st, Object value, int index, SessionImplementor session)
Any help is appreciated.