I have a hibernate Usertype something like this:
public class UUIDHibernateType implements UserType { private static final int[] SQL_TYPES = new int[] { Types.CHAR }; public int[] sqlTypes () { return SQL_TYPES; }
The problem is that hibernate generates a sql script with CHAR (1) types, which is wrong, I really need CHAR (36). How to determine the default length of a custom type?
At the moment, I am fixated on the definition of the sql type as follows:
<id name="id" type="org.openscada.ae.server.storage.jdbc.internal.UUIDHibernateType"> <column name="ID" length="36" sql-type="CHAR(36)" not-null="true" /> <generator class="assigned" /> </id>
In this case, this should not be a problem, but how would I do it if such a need arises?
PS: If someone better understands how to handle UUIDs transparently and agnosticize databases, I am grateful.
java uuid hibernate
Mauli
source share