I'm writing a UserType that can possibly support multiple JDBC types. The types supported depend on the version of the JDBC driver the application uses. If the driver version is <= JDBC 4.1 then a custom vendor type is used. If the driver version is >= JDBC 4.2 a standard type is used.
My code currently looks like this:
Code:
public int[] sqlTypes() {
return new int []{Types.FOO, VendorTypes.FOO};
}
This doesn't work because Hibernate then expects two columns. If possible I'd like to avoid having to write a UserType for every driver version. Is there a better way to do this?