Hi, I tried using the code shown on page no.215 for map a treeMap. I am trying it exactly how it is shown in book but every time I try to persist I am getting following error. Its such a simple thing to do but I am unable to understand the cause of error.
my setter is as below: public void setEntries(TreeMap entries) { this.entries = entries; }
and mapping is: <map name="entries" table="ent" lazy="false" sort="natural" cascade="all"> ----- </map>
ERROR o.h.property.BasicPropertyAccessor expected type: java.util.TreeMap, actual value: org.hibernate.collection.PersistentSortedMap 12:01:15.277 [AnonymousIoService-13] ERROR errors Exception caught! java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.invoke(DispatchListener.java:175) [miriamlaurel-pms-1.0-SNAPSHOT.jar:na] at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.processMessage(DispatchListener.java:111) [miriamlaurel-pms-1.0-SNAPSHOT.jar:na] at com.miriamlaurel.blackjack.server.SessionManager.messageReceived(SessionManager.java:385) [classes/:na] at com.miriamlaurel.blackjack.server.SessionManager.messageReceived(SessionManager.java:1) [classes/:na] at org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:141) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain$TailFilter.messageReceived(AbstractIoFilterChain.java:570) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) [mina-core-1.1.7.jar:na] at org.apache.mina.filter.codec.support.SimpleProtocolDecoderOutput.flush(SimpleProtocolDecoderOutput.java:58) [mina-core-1.1.7.jar:na] at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:180) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain.callNextMessageReceived(AbstractIoFilterChain.java:299) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain.access$1100(AbstractIoFilterChain.java:53) [mina-core-1.1.7.jar:na] at org.apache.mina.common.support.AbstractIoFilterChain$EntryImpl$1.messageReceived(AbstractIoFilterChain.java:648) [mina-core-1.1.7.jar:na] at org.apache.mina.filter.executor.ExecutorFilter.processEvent(ExecutorFilter.java:220) [mina-core-1.1.7.jar:na] at org.apache.mina.filter.executor.ExecutorFilter$ProcessEventsRunnable.run(ExecutorFilter.java:264) [mina-core-1.1.7.jar:na] at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [na:1.6.0_13] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [na:1.6.0_13] at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51) [mina-core-1.1.7.jar:na] at java.lang.Thread.run(Thread.java:619) [na:1.6.0_13] Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_13] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_13] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_13] at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_13] at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.invoke(DispatchListener.java:171) [miriamlaurel-pms-1.0-SNAPSHOT.jar:na] ... 19 common frames omitted Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.invoke(DispatchListener.java:175) [miriamlaurel-pms-1.0-SNAPSHOT.jar:na] at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.processMessage(DispatchListener.java:111) [miriamlaurel-pms-1.0-SNAPSHOT.jar:na] at com.miriamlaurel.blackjack.server.SessionManager.onMessage(SessionManager.java:177) [classes/:na] ... 24 common frames omitted Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_13] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_13] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_13] at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_13] at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.invoke(DispatchListener.java:171) [miriamlaurel-pms-1.0-SNAPSHOT.jar:na] ... 26 common frames omitted Caused by: org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred while calling setter of com.miriamlaurel.fi.protocol.model.Quote.bidEntries; nested exception is org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.miriamlaurel.fi.protocol.model.Quote.bidEntries at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:661) [spring-2.5.4.jar:2.5.4] at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) [spring-2.5.4.jar:2.5.4] at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424) [spring-2.5.4.jar:2.5.4] at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) [spring-2.5.4.jar:2.5.4] at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:744) [spring-2.5.4.jar:2.5.4] at com.tsdevelopment.blackjack.server.dao.impl.hibernate.OrderDaoImpl.storeOrder(OrderDaoImpl.java:42) [classes/:na] at com.miriamlaurel.blackjack.server.services.DataManager.storeOrder(DataManager.java:59) [classes/:na] at com.miriamlaurel.blackjack.server.services.SignalOrderProcessor.putOrder(SignalOrderProcessor.java:86) [classes/:na] at com.miriamlaurel.blackjack.server.services.SignalOrderProcessor.process(SignalOrderProcessor.java:396) [classes/:na] at com.miriamlaurel.blackjack.server.dispatch.AccountDispatcher.onSignal(AccountDispatcher.java:134) [classes/:na] ... 31 common frames omitted Caused by: org.hibernate.PropertyAccessException: IllegalArgumentException occurred while calling setter of com.miriamlaurel.fi.protocol.model.Quote.bidEntries at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:128) [hibernate-3.3.1.GA.jar:na] at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:360) [hibernate-3.3.1.GA.jar:na] at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:221) [hibernate-3.3.1.GA.jar:na] at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3594) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:300) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:144) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) [hibernate-3.3.1.GA.jar:na] at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) [hibernate-3.3.1.GA.jar:na] at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534) [hibernate-3.3.1.GA.jar:na] at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526) [hibernate-3.3.1.GA.jar:na] at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522) [hibernate-3.3.1.GA.jar:na] at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:747) [spring-2.5.4.jar:2.5.4] at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) [spring-2.5.4.jar:2.5.4] ... 38 common frames omitted Caused by: java.lang.IllegalArgumentException: argument type mismatch at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [na:1.6.0_13] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [na:1.6.0_13] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [na:1.6.0_13] at java.lang.reflect.Method.invoke(Method.java:597) [na:1.6.0_13] at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:66) [hibernate-3.3.1.GA.jar:na] ... 53 common frames omitted
Kidnly help!
Thanks milly
|