Hi!
I'm using MySQL 4.x.x, Hibernate 2.1 and Spring 1.0.1.
I'm developing a webapp that will be able to catch data concerning healthcare from many forms and users. A big part of data is entered
through checkboxes (multiple choices) and radiobuttons.
An Event holds a composite collection of EventFieldOptionNode objects. EFONode in its turn denotes 1:M-relations with both PageField
(object representing the field in HTML form) and FieldOption.
I've managed to get a HTML-form with options behave as expected, i.e I can add and delete options freely. But when I empty one field
completely (uncheck all options) I get this exception (with last piece of debug trace):
Code:
16:25:16,875 DEBUG SessionImpl:542 - opened session
16:25:16,875 DEBUG JDBCTransaction:37 - begin
16:25:16,890 DEBUG JDBCTransaction:41 - current autocommit status:true
16:25:16,890 DEBUG JDBCTransaction:43 - disabling autocommit
16:25:16,890 DEBUG Cascades:341 - id unsaved-value strategy NULL
16:25:16,890 DEBUG SessionImpl:1384 - saveOrUpdate() previously saved instance with id: 5
16:25:16,906 DEBUG SessionImpl:1432 - updating [ks.rah.avik2.domain.Event#5]
16:25:16,906 DEBUG SessionImpl:1279 - collection dereferenced while transient [ks.rah.avik2.domain.Event.entries#5]
16:25:16,906 DEBUG Cascades:497 - processing cascades for: ks.rah.avik2.domain.Event
16:25:16,906 DEBUG Cascades:113 - cascading to saveOrUpdate()
16:25:16,906 DEBUG Cascades:341 - id unsaved-value strategy NULL
16:25:16,921 DEBUG SessionImpl:1384 - saveOrUpdate() previously saved instance with id: 5
16:25:16,921 DEBUG SessionImpl:1432 - updating [ks.rah.avik2.domain.Function#5]
16:25:16,921 DEBUG Cascades:497 - processing cascades for: ks.rah.avik2.domain.Function
16:25:16,921 DEBUG Cascades:524 - cascading to collection: ks.rah.avik2.domain.Function.functionnaires
16:25:16,921 DEBUG Cascades:113 - cascading to saveOrUpdate()
16:25:16,921 DEBUG Cascades:341 - id unsaved-value strategy NULL
16:25:16,937 DEBUG SessionImpl:1384 - saveOrUpdate() previously saved instance with id: 42
16:25:16,953 DEBUG SessionImpl:1432 - updating [ks.rah.avik2.domain.AvikUser#42]
16:25:16,953 DEBUG Cascades:524 - cascading to collection: ks.rah.avik2.domain.Function.delegated
16:25:16,953 DEBUG Cascades:506 - done processing cascades for: ks.rah.avik2.domain.Function
16:25:16,968 DEBUG Cascades:524 - cascading to collection: ks.rah.avik2.domain.Event.entries
16:25:16,968 ERROR BasicPropertyAccessor:106 - IllegalArgumentException in class: ks.rah.avik2.domain.support.EventFie
OptionNode, getter method of property: field
16:25:16,968 DEBUG JDBCTransaction:82 - rollback
16:25:16,984 DEBUG SessionImpl:572 - transaction completion
16:25:16,984 DEBUG JDBCTransaction:103 - re-enabling autocommit
16:25:16,984 DEBUG SessionImpl:560 - closing session
16:25:16,984 DEBUG SessionImpl:3327 - disconnecting session
16:25:16,984 DEBUG SessionImpl:572 - transaction completion
16:25:17,000 WARN DispatcherServlet:414 - Handler execution resulted in exception - forwarding to resolved error view
org.springframework.orm.hibernate.HibernateSystemException: IllegalArgumentException occurred calling getter of ks.rah.a
vik2.domain.support.EventFieldOptionNode.field; nested exception is net.sf.hibernate.PropertyAccessException: IllegalArg
umentException occurred calling getter of ks.rah.avik2.domain.support.EventFieldOptionNode.field
net.sf.hibernate.PropertyAccessException: IllegalArgumentException occurred calling getter of ks.rah.avik2.domain.suppor
t.EventFieldOptionNode.field
at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:110)
at net.sf.hibernate.type.ComponentType.getPropertyValue(ComponentType.java:179)
at net.sf.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:205)
at net.sf.hibernate.type.ComponentType.getPropertyValues(ComponentType.java:183)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:460)
at net.sf.hibernate.engine.Cascades.cascadeCollection(Cascades.java:526)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:452)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:503)
at net.sf.hibernate.engine.Cascades.cascade(Cascades.java:482)
at net.sf.hibernate.impl.SessionImpl.doUpdate(SessionImpl.java:1467)
at net.sf.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:1385)
at org.springframework.orm.hibernate.HibernateTemplate$10.doInHibernate(HibernateTemplate.java:259)
at org.springframework.orm.hibernate.HibernateTemplate.execute(HibernateTemplate.java:150)
at org.springframework.orm.hibernate.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:257)
at ks.rah.avik2.dao.impl.hibernate.EventDaoImpl.createEvent(EventDaoImpl.java:47)
at ks.rah.avik2.logic.LogicFacadeImpl.createEvent(LogicFacadeImpl.java:211)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at org.springframework.aop.framework.AopProxyUtils.invokeJoinpointUsingReflection(AopProxyUtils.java:59)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:
149)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:118)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:169)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:138)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:148)
at $Proxy1.createEvent(Unknown Source)
at ks.rah.avik2.web.form.EventFormController.onSubmit(EventFormController.java:316)
at org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmission(SimpleFormController.java:201)
at org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInternal(AbstractFormController.java:
236)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:119)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java
:45)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:389)
at org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:342)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:328)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2422)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:163)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:199)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:828)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:700)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:584)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)
Caused by: java.lang.IllegalArgumentException: java.lang.ClassCastException@19302fb
at sun.reflect.GeneratedMethodAccessor203.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at net.sf.hibernate.property.BasicPropertyAccessor$BasicGetter.get(BasicPropertyAccessor.java:96)
... 65 more
Mapping of Event class as follows:
Code:
<hibernate-mapping>
<class
name="ks.rah.avik2.domain.Event"
table="event"
dynamic-update="false"
dynamic-insert="false"
>
<id
name="id"
column="id"
type="java.lang.Long"
unsaved-value="null"
>
<generator class="native">
</generator>
</id>
<property
name="type"
type="ks.rah.avik2.domain.support.EventTypeType"
update="true"
insert="true"
column="eventtype"
/>
<property
name="status"
type="ks.rah.avik2.domain.support.EventStatusType"
update="true"
insert="true"
column="eventstatus"
/>
[etc. etc. etc. etc forever]
.
.
.
<property
name="auxComment"
type="text"
update="true"
insert="true"
column="ev_aux"
/>
<bag
name="entries"
table="optionentries"
lazy="false"
inverse="false"
cascade="all-delete-orphan"
>
<key
column="event_fk"
/>
<composite-element
class="ks.rah.avik2.domain.support.EventFieldOptionNode"
>
<many-to-one
name="field"
class="ks.rah.avik2.domain.ui.PageField"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="field_fk"
/>
<many-to-one
name="option"
class="ks.rah.avik2.domain.ui.FieldOption"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="option_fk"
/>
<property
name="created"
type="java.util.Date"
update="true"
insert="true"
column="created"
/>
<many-to-one
name="creator"
class="ks.rah.avik2.domain.AvikUser"
cascade="none"
outer-join="auto"
update="true"
insert="true"
column="user_fk"
/>
</composite-element>
</bag>
<set
name="textEntries"
lazy="false"
inverse="true"
cascade="all"
sort="unsorted"
>
<key
column="event_fk"
/>
<one-to-many
class="ks.rah.avik2.domain.support.TextEntry"
/>
</set>
<!--
To add non XDoclet property mappings, create a file named
hibernate-properties-Event.xml
containing the additional properties and place it in your merge dir.
-->
</class>
</hibernate-mapping>
Does anybody recognize this exception..... EventFieldOptionNode has a standard argument (i.e 'void') getter for property field....
Sincerely,
/Cantor