Hi, I am just not able to understand the reason for getting following error while saving my java TreeMap using hibernate. My hibernate mapping is
<map name="entries" table="bid_values" lazy="false" sort="natural"> <key column="ID" /> <index column="price"/> <composite-element class="Entry"> <property name="type" column="type"/> <property name="volume" column="volume"/> </composite-element> </map>
And error and exception is as follows:
16:05:23.552 [Thread-3] ERROR o.h.property.BasicPropertyAccessor expected type: java.util.TreeMap, actual value: org.hibernate.collection.PersistentSortedMap org.springframework.orm.hibernate3.HibernateSystemException: IllegalArgumentException occurred while calling setter of entries; 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) at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:424) at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374) at org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(HibernateTemplate.java:744) at com.miriamlaurel.blackjack.server.services.DataManager.storeOrder(DataManager.java:101) at com.miriamlaurel.fi.protocol.model.Market.onQuote(Market.java:170) at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.invoke(DispatchListener.java:171) at com.miriamlaurel.pms.listeners.dispatch.DispatchListener.processMessage(DispatchListener.java:111) at com.miriamlaurel.pms.listeners.MessageListenerDelegate.processMessage(MessageListenerDelegate.java:40) at com.miriamlaurel.blackjack.maya.MockFeedEmitter.run(MockFeedEmitter.java:159) 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) at org.hibernate.tuple.entity.AbstractEntityTuplizer.setPropertyValues(AbstractEntityTuplizer.java:360) at org.hibernate.tuple.entity.PojoEntityTuplizer.setPropertyValues(PojoEntityTuplizer.java:221) at org.hibernate.persister.entity.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:3594) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:300) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:204) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:144) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:210) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:195) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:117) at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:93) at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:534) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:526) at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:522) at org.springframework.orm.hibernate3.HibernateTemplate$16.doInHibernate(HibernateTemplate.java:747) at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:419) ... 11 more Caused by: java.lang.IllegalArgumentException: argument type mismatch 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:597) at org.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:66) ... 26 more
any help appreciated!
cheers!
|