Regular |
|
Joined: Wed Sep 21, 2005 1:37 pm Posts: 53 Location: Montpellier - France
|
Hi,
I'm trying to persist a map but a ClassCastException occurs when trying to count the items (select count suing a native query).
I use the 3.3.0.SP1 release of hibernate core.
The mapping file: <map name="properties" table="PROPERTIES" lazy="true" mutable="true"> <key column="PKEY" not-null="true" foreign-key="PKEY" /> <map-key type="java.lang.String" column="NAME" length="64" /> <element column="VALUE" type="java.lang.String" length="255" not-null="false" /> </map> <component name="licenses" lazy="false" class="LicensesImpl"> <map name="values" table="LICENSES" lazy="false" mutable="true"> <key column="PKEY" not-null="true" foreign-key="PKEY" /> <map-key column="FEATURE" type="java.lang.String" length="32" /> <element column="VALUE" type="java.lang.Boolean" not-null="false" /> </map> </component>
The properties seems to be ok (I have tried without it) but not the licenses.
The exception is described below: Caused by: java.lang.ClassCastException: java.util.HashMap cannot be cast to org.hibernate.collection.PersistentCollection at org.hibernate.event.def.DirtyCollectionSearchVisitor.processCollection(DirtyCollectionSearchVisitor.java:74) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:124) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:84) at org.hibernate.event.def.AbstractVisitor.processValues(AbstractVisitor.java:63) at org.hibernate.event.def.AbstractVisitor.processComponent(AbstractVisitor.java:105) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:130) at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:84) at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues(AbstractVisitor.java:78) at org.hibernate.event.def.DefaultFlushEntityEventListener.hasDirtyCollections(DefaultFlushEntityEventListener.java:451) at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:439) at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:228) at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:150) at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:219) at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:99) at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:58) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102) at org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:88)
Thanks.
|
|