Skip to content

Repository with Enum argument: json can't serialize type [DATAMONGO-1421] #2332

Closed
@spring-projects-issues

Description

@spring-projects-issues

Agoston Horvath opened DATAMONGO-1421 and commented

With version 1.8.2.RELEASE, our enum maps correctly to a string in the DB and vica versa.
If I simply change the spring-data-mongo version to 1.9.1.RELEASE, it breaks with the following stacktrace:

java.lang.RuntimeException: json can't serialize type : class com.bol.service.olg.server.beans.EmbeddedSocialListBean$SocialListType
	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)

Was the enum mapping feature removed from version 1.9.1 ?


Affects: 1.9.1 (Hopper SR1), 2.0 M1 (Kay), 1.10 GA (Ingalls)

Referenced from: pull request #448

Backported to: 1.10.2 (Ingalls SR2), 1.9.9 (Hopper SR9)

Metadata

Metadata

Labels

in: mappingMapping and conversion infrastructurein: repositoryRepositories abstractiontype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions