I have an issue dealing with Hibernate and Oracle tables that have CHAR fields that participate in the primary key of these tables.
Specifically, we are tired of having to pad our objects' (char) instance variable values before we let hibernate retrieve and or update a row that has a CHAR in the primary key.
Yes, I agree, CHAR fields have no business being part of a primary key in any relational table, but, these table designs are from years and years ago, and, I guess, there's no desire to truely fix this by changing the offending database columns to be varchar....So, we're stuck for the time being dealing with this.
Further details: What happens is that, unless you pad the char variable out to the size of the CHAR field in the DB, you will not be able to retrieve/update an existing DB row b/c of how CHAR field mapping evidently works within Hibernate.
I have tried implementing our own TrimmedString UserType to no avail. This user-defined UserType seems to have no effect on hibernate's dealing's with primary key values, but does work for retrieving non-key CHAR values.
So, my question is, does anyone have any ideas on how to "fix" this so we don't have to pad our instance (char) variable values before letting hibernate do it's thing?
|