-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: any-mapping in hibernate3
PostPosted: Tue May 24, 2005 6:55 am 
Newbie

Joined: Tue Feb 08, 2005 4:16 am
Posts: 14
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hi!!

I am upgrading a large project to hibernate-3.0.4

I am getting stack with any-mapping that use meta-type="class":
<any name="parent" meta-type="class" id-type="long" cascade="save-update">
<column name="PARENT_ENTITY_NAME" not-null="true" length="200" unique="false" />
<column name="PARENT_PRIMARY_KEY" not-null="true" unique="false" />
</any>

there is a ClassCastException in AnyType.nullSafeSet that seems to pass a String object (entityName) to the ClassType.nullSafeSet which in turn cast it to Class and fails.

Are ther any changes to the any-mapping style in hibernate-3.0?

Thanks




Hibernate version:
3.0.4
Mapping documents:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping
>
<class
name="com.mercury.dashboard.model.access.AuthorizedUser"
table="DSH_AUTHORIZED_USERS"
proxy="com.mercury.dashboard.model.access.AuthorizedUser"
dynamic-update="false"
dynamic-insert="false"
select-before-update="false"
optimistic-lock="version"
>

<id
name="authorizedUserId"
column="AUTHORIZED_USER_ID"
type="long"
unsaved-value="-1"
>
<generator class="hilo">
<!--
To add non XDoclet generator parameters, create a file named
hibernate-generator-params-AuthorizedUser.xml
containing the additional parameters and place it in your merge dir.
-->
</generator>
</id>

<version
name="version"
type="int"
column="VERSION"
access="property"
unsaved-value="undefined"
/>

<property
name="userId"
type="string"
update="true"
insert="true"
access="property"
column="USER_ID"
length="200"
not-null="true"
unique="false"
/>

<property
name="type"
type="string"
update="true"
insert="true"
access="property"
column="TYPE"
length="10"
not-null="false"
unique="false"
/>

<any name="parent" meta-type="class" id-type="long" cascade="save-update">
<column name="PARENT_ENTITY_NAME" not-null="true" length="200" unique="false" />
<column name="PARENT_PRIMARY_KEY" not-null="true" unique="false" />
</any>

</class>

</hibernate-mapping>


Top
 Profile  
 
 Post subject: ClassCastException in ClassType.java
PostPosted: Tue May 24, 2005 9:19 am 
Newbie

Joined: Tue Feb 08, 2005 4:16 am
Posts: 14
this is the exception:

java.lang.ClassCastException
org.hibernate.type.ClassType.set(ClassType.java:35)
org.hibernate.type.NullableType.nullSafeSet(NullableType.java:62)
org.hibernate.type.NullableType.nullSafeSet(NullableType.java:44)
org.hibernate.type.AnyType.nullSafeSet(AnyType.java:135)
org.hibernate.type.AnyType.nullSafeSet(AnyType.java:118)
org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1617)
org.hibernate.persister.entity.BasicEntityPersister.dehydrate(BasicEntityPersister.java:1594)
org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:1850)
org.hibernate.persister.entity.BasicEntityPersister.insert(BasicEntityPersister.java:2200)
org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:46)
org.hibernate.engine.ActionQueue.execute(ActionQueue.java:239)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:223)
org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:136)
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:274)
org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:48)
org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:711)
org.hibernate.impl.SessionImpl.prepareQueries(SessionImpl.java:895)
org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:885)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
com.mercury.dashboard.arch.db.DBUtils.getList(DBUtils.java:88)
com.mercury.dashboard.arch.web.tag.DSHPageInfoTag.doStartTag(DSHPageInfoTag.java:27)
org.apache.jsp.arch.CreateDashboardPageList_jsp._jspx_meth_dsh_setUserPageInfo_0(CreateDashboardPageList_jsp.java:83)
org.apache.jsp.arch.CreateDashboardPageList_jsp._jspService(CreateDashboardPageList_jsp.java:59)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
org.apache.jsp.arch.Header_jsp._jspService(Header_jsp.java:304)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
org.apache.jsp.app.module.ConfigureModule_jsp._jspService(ConfigureModule_jsp.java:207)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
com.mercury.dashboard.arch.host.util.DashboardFilterServlet.service(DashboardFilterServlet.java:112)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
com.mercury.dashboard.arch.host.DashboardServlet.service(DashboardServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
com.mercury.dashboard.arch.host.MultipartRequestFilter.applyFilter(MultipartRequestFilter.java:66)
com.mercury.dashboard.arch.host.BaseFilter.doFilter(BaseFilter.java:52)
com.mercury.mycenter.authentication.MyCenterAuthenticationFilter.doFilter(MyCenterAuthenticationFilter.java:84)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jun 05, 2006 5:56 pm 
Newbie

Joined: Thu Mar 10, 2005 2:16 pm
Posts: 1
I had a project with several <any> mappings and ran into a similar problem when upgrading from 2.1.7 to 3.1.3. I was able to get things working again by doing the following.

Remove the meta-type attribute from the any mapping. (Essentially using the default).
Before:
Code:
<any
   name="parent"
   id-type="long"
   meta-type="class"
   cascade="save-update"
   access="property"
>


After:
Code:
<any
   name="parent"
   id-type="long"

   cascade="save-update"
   access="property"
>



Hopefully that gets you going.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.