Closed
Description
yami.veranes opened DATAMONGO-1500 and commented
When I upgrade from version 1.8.4.RELEASE to 1.9.3.RELEASE, I have some problems with serialization of DBRef
and Enum
@Query(fields = "{ 'text' : 0, 'statistics' : 0}")
Page<DocumentManualRevision> findByRevisor(User revisor, Pageable p);
the execution of the previous function (where revisor is a dbref of other collection) return the following exception
java.lang.RuntimeException: json can't serialize type : class database.models.security.User
at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323)
at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82)
at com.mongodb.util.JSON.serialize(JSON.java:53)
at com.mongodb.util.JSON.serialize(JSON.java:39)
at com.mongodb.BasicDBObject.toString(BasicDBObject.java:196)
at org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113)
at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:460)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
at com.sun.proxy.$Proxy56.findByRevisorAndCreatedBetween(Unknown Source)
@Query(fields = "{ 'text' : 0, 'statistics' : 0}")
Page<DocumentManualRevision> findByState(State state, Pageable p)
the execution of the previous function (where state is enum) return the following exception
java.lang.RuntimeException: json can't serialize type : class database.models.revision.DocumentManualRevision$State
at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:323)
at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:82)
at com.mongodb.util.JSON.serialize(JSON.java:53)
at com.mongodb.util.JSON.serialize(JSON.java:39)
at com.mongodb.BasicDBObject.toString(BasicDBObject.java:196)
at org.springframework.data.mongodb.repository.query.PartTreeMongoQuery.createQuery(PartTreeMongoQuery.java:113)
at org.springframework.data.mongodb.repository.query.AbstractMongoQuery.execute(AbstractMongoQuery.java:81)
at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:482)
Affects: 1.9.3 (Hopper SR3)
Referenced from: pull request #404
Backported to: 1.9.5 (Hopper SR5)