Folks,
My database uses fixed-length CHAR fields, which I map to variable length String objects. So I would like to employ a custom UserType to trim and pad the DB values as they come and go. However, my UserType implementor needs to know the length of the corresponding column in order to perform the pad. I've tried something like this inside nullSafeSet:
PreparedStatement statement_, int index_
columnWidth = statement_.getMetaData().getColumnDisplaySize(index_)
but my jdbc driver doesn't seem to support this call before ins upd or del:
[junit] java.sql.SQLException: [NEON][SCOD32TR.DLL]No columns available to describe
[junit] at com.neon.jdbc.SQLError.Check(SQLError.java:410)
[junit] at com.neon.jdbc.ProxyLocal.SQLColAttributes(ProxyLocal.java:1311)
Is there some way for a UserType to find which entity.property it is mapping for? It seems like it would be natural for this guy to either be constructed with that information, or to have it passed into nullSafeSet/get, or at least for some simple technique to retrieve it. I could use ParameterizedType, but then I'm essentially duplicating this information.
thanks,
joe
|