Hi all,
I have a Class HibernateDataEventAudit with a Map (HashMap) newData which contains String as key and Object (can't know which type at development time).
So I have set the following mapping with Hibernate 2.1.1 :
<joined-subclass name="HibernateDataEventAudit" table="dataeventaudits"> (PostgreSQL)
<key column="id"/>
<map name="newData" table="neweventauditdata">
<key column="dataeventaudit"/>
<index column="variabledefinitionid" type="string"/>
<element column="variablevalue" type="binary"/>
</map>
</joined-subclass>
I'm sure that at runtime, the map to be persited is not null :
CREATE TABLE "neweventauditdata" (
"dataeventaudit" numeric(19,0) NOT NULL,
"variabledefinitionid" character varying(254) NOT NULL,
"variablevalue" bytea NOT NULL)
I get and ClassCast :
java.lang.ClassCastException
at net.sf.hibernate.type.BinaryType.set(BinaryType.java:28)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.collection.AbstractCollectionPersister.writeElement(AbstractCollectionPersister.java:384)
at net.sf.hibernate.collection.Map.writeTo(Map.java:194)
at net.sf.hibernate.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:537)
at net.sf.hibernate.impl.ScheduledCollectionRecreate.execute(ScheduledCollectionRecreate.java:23)
at net.sf.hibernate.impl.SessionImpl.executeAll(SessionImpl.java:2308)
at net.sf.hibernate.impl.SessionImpl.execute(SessionImpl.java:2265)
at net.sf.hibernate.impl.SessionImpl.flush(SessionImpl.java:2187)
at net.sf.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:61)
I have tried to set the column variable value to character varying but the same exception occurs.
Any Idea
|