Object binding and List<Map<String, Object>>

75 views
Skip to first unread message

Daniel Hoffmann Bernardes

unread,
Jun 13, 2014, 4:15:15 PM6/13/14
to orient-...@googlegroups.com

Hello, I am using OrientDb with an Object Database and I am having trouble persisting this kind of class:

public class MyClass {
   
List<Map<String, Object>> properties;
   
... //other properties and setters and getters
}

oddly I can map the following data structures just fine: 

Map<String, Map<String,Object>>



List<String>,

List<List<String>>,

Map<String, List<String>>


For some reason Lists of Maps are giving me problems.

Just to clear it out I want to have an Embedded List of Embedded Maps in the database. Which would give me the following JSON representation:

[
     
{
           
//properties as String, Object pairs
     
},     {
           
//properties as String, Object pairs
     
},     {



           
//properties as String, Object pairs
     
},
     
...
]


When I try to persist classes like the MyClass above I get the following error:

java.lang.ClassCastException: java.lang.String cannot be cast to com.orientechnologies.orient.core.db.record.OIdentifiable

I get the same error if I try to set the field as List<Map<String,String>>

Stacktrace:

"com.orientechnologies.orient.core.db.record.ORecordLazyMap.put(ORecordLazyMap.java:37)",
"com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.multiValueToStream(OObjectEntitySerializer.java:1272)",
"com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.typeToStream(OObjectEntitySerializer.java:699)",
"com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.multiValueToStream(OObjectEntitySerializer.java:1259)",
"com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.typeToStream(OObjectEntitySerializer.java:696)",
"com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.toStream(OObjectEntitySerializer.java:1096)",
"com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.serializeObject(OObjectEntitySerializer.java:120)",
"com.orientechnologies.orient.object.db.OObjectDatabaseTx.save(OObjectDatabaseTx.java:421)",
"com.orientechnologies.orient.object.db.OObjectDatabaseTx.save(OObjectDatabaseTx.java:343)",
"com.icarotech.advdash.impl.entity.repository.OrientDbDatabaseExecutor.save(OrientDbDatabaseExecutor.java:174)",
"com.icarotech.advdash.impl.entity.service.OrientDbService.save(OrientDbService.java:51)",
"com.icarotech.advdash.controller.rest.entity.EntityRestController.create(EntityRestController.java:94)",
"sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)",
"sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)",
"sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)",
"java.lang.reflect.Method.invoke(Method.java:606)",
"org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:219)",
"org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)",
"org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)",
"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)",
"org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)",
"org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)",
"org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)",
"org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)",
"org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)",
"org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:838)",
"javax.servlet.http.HttpServlet.service(HttpServlet.java:647)",
"org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)",
"javax.servlet.http.HttpServlet.service(HttpServlet.java:728)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)",
"org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)",
"org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)",
"org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)",
"org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)",
"org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.session.ConcurrentSessionFilter.doFilter(ConcurrentSessionFilter.java:125)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)",
"org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)",
"org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)",
"org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)",
"org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)",
"org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)",
"org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)",
"org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)",
"org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)",
"org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)",
"org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)",
"org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)",
"org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)",
"org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)",
"org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)",
"org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)",
"org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)",
"org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)",
"org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)",
"java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)",
"java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)",
  "java.lang.Thread.run(Thread.java:724)"

Daniel Hoffmann Bernardes

unread,
Jun 13, 2014, 4:15:42 PM6/13/14
to orient-...@googlegroups.com
I am using version 1.7-rc2 of OrientDb

Daniel Hoffmann Bernardes

unread,
Jun 18, 2014, 3:46:03 PM6/18/14
to orient-...@googlegroups.com
Can anyone help me out? I thought OrientDb would have no problem with recursive embedded records...

MrFT

unread,
Jun 19, 2014, 1:02:57 PM6/19/14
to orient-...@googlegroups.com
To add to this,

I just found out (1.7.2) that

select list( 1, 4, 5.00, "john", map( "kAA", "vAA" ) ) as myresult

returns 

[1,4,5,"john","vAA"]

so it seems to completely ignore the map inside the list.




Op woensdag 18 juni 2014 21:46:03 UTC+2 schreef Daniel Hoffmann Bernardes:

Artem Orobets

unread,
Jun 20, 2014, 1:19:28 AM6/20/14
to orient-...@googlegroups.com
Hi Daniel,

This looks like a bug, could you create an issue?

Best regards,
Artem Orobets

Orient Technologies

the Company behind OrientDB



--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Daniel Hoffmann Bernardes

unread,
Jun 20, 2014, 9:29:25 AM6/20/14
to orient-...@googlegroups.com
Issue created, I have also debugged the code and I think I found out where the problem is please look at the Issue to see if I am correct:


--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/jfeLdrG0I_g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages