Error added: 2008-02-26T09:40:24Z
Argh. I just noticed why I was seeing this error. In my implementation of UserType, I had mistyped: @Override public int[] sqlTypes() { return new int[]{Types.INTEGER}; } as ... @Override public int[] sqlTypes() { return new int[Types.INTEGER]; } Of course it compiled, but was ultimately wrong...
A clue: if a persistent property on an entity is declared as java.lang.Object, it throws this error, but change it to java.io.Serializable (or something that implements it), and it doesn\'t complain.
Be sure that your custom type class (the one implementing UserType) returns an array of length n from sqlTypes(), where n is the number of columns that the property maps. I\'m guessing the property is only mapped to only one column. Note that sqlTypes() returns an array of types that MUST be used, not the different types that CAN be used. So if sqlTypes() returns an array of length 3, hibernate will assume you must have three columns mapped to the custom type.
If using a CompositeUserType for a property, the property\'s getter method must be annotated with the @Columns annotation and the composite user type class\' getPropertyTypes() method must return an array of the exact same size as the number of @Column annotations specified in your @Columns annotation (Hibernate 3.5.1 + Java)
If the column mapped in the database is of type CLOB or BLOB just put the @Lob annotation in hibernate mapping.
Check that your @TypeDef annotation is correct. Ensure that "typeClass" is the type descriptor class and that "defaultForType" is the object instance class.
In Grails this might also happen with CompositeUserType if the static embedded = ['nameOfCompositeAttribute'] isn't specified
No one works to me !
If you know the answer, please add your own solution below.
If you don't know, but find out later, please come back and share your answer - there will be other people
struggling with this too.
If you want to be notified via email when this is solved, enter your email address here: