posted 19 years ago
Hi everybody,
I'm having problems while trying to update a table that have 2 children (one-to-one map for both):
java.lang.ClassCastException at net.sf.hibernate.type.LongType.set(LongType.java:35)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:48)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loader.java:749)
at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:788)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:265)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:931)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.loadByUniqueKey(EntityLoader.java:55)
at net.sf.hibernate.persister.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1117)
at net.sf.hibernate.impl.SessionImpl.loadByUniqueKey(SessionImpl.java:3897)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:207)
at net.sf.hibernate.type.EntityType.copy(EntityType.java:113)
at net.sf.hibernate.type.TypeFactory.copy(TypeFactory.java:284)
at net.sf.hibernate.impl.SessionImpl.doCopy(SessionImpl.java:4091)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdateCopy(SessionImpl.java:4029)
at br.atech.foundation.persistence.hibernate.AbstractHibernatePersistenceManager.update(AbstractHibernatePersistenceManager.java:349)
Check out my hbm.xml:
<class
name="xyz.Editor"
table="EDITOR"
>
<id
name="id"
type="java.lang.Long"
column="ID"
>
<generator class="increment" />
</id>
<!-- associations -->
<!-- bi-directional one-to-one association to EditorText -->
<one-to-one
name="editorText"
class="xyz.EditorText"
outer-join="auto"
property-ref="editor"
cascade="all"
/>
<!-- bi-directional one-to-one association to EditorImage -->
<one-to-one
name="editorImage"
class="xyz.EditorImage"
outer-join="auto"
property-ref="editor"
cascade="all"
/>
</class>
...
<class
name="xyz.EditorImage"
table="EDITOR_IMAGE"
>
<id
name="id"
type="java.lang.Long"
column="ID"
>
<generator class="increment" />
</id>
<property
name="image"
type="binary"
column="IMAGE"
/>
<!-- associations -->
<!-- bi-directional one-to-one association to Editor -->
<many-to-one
name="editor"
class="xyz.Editor"
unique="true"
>
<column name="EDITOR_ID" />
</many-to-one>
</class>
...
<class
name="xyz.EditorText"
table="EDITOR_TEXT"
>
<id
name="id"
type="java.lang.Long"
column="ID"
>
<generator class="increment" />
</id>
<property
name="text"
type="binary"
column="TEXT"
/>
<!-- associations -->
<!-- bi-directional one-to-one association to Editor -->
<many-to-one
name="editor"
class="xyz.Editor"
unique="true"
>
<column name="EDITOR_ID" />
</many-to-one>
</class>
Can you help me, please!?
Thx