Comments (8)
David Harrigan commented
Hi,
Would you have an example of the JSON document containing the class field and data?
-=david=-
from spring-data-couchbase.
Michael Nitschinger commented
How do you store the value? If I try to store a Class type as a property, I can even get it to store, Jackson complains immediately:
java.lang.IllegalStateException: No ObjectCodec defined for the generator, can only serialize simple wrapper types (type passed java.lang.Class)
at com.fasterxml.jackson.core.base.GeneratorBase._writeSimpleObject(GeneratorBase.java:515)
at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:262)
at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encodeRecursive(JacksonTranslationService.java:92)
at org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService.encode(JacksonTranslationService.java:62)
at org.springframework.data.couchbase.core.CouchbaseTemplate.translateEncode(CouchbaseTemplate.java:79)
at org.springframework.data.couchbase.core.CouchbaseTemplate.access$000(CouchbaseTemplate.java:40)
at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:116)
at org.springframework.data.couchbase.core.CouchbaseTemplate$2.doInBucket(CouchbaseTemplate.java:113)
at org.springframework.data.couchbase.core.CouchbaseTemplate.execute(CouchbaseTemplate.java:236)
at org.springframework.data.couchbase.core.CouchbaseTemplate.save(CouchbaseTemplate.java:113)
at org.springframework.data.couchbase.core.CouchbaseTemplateTests.shouldSaveClassProperty(CouchbaseTemplateTests.java:215)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:74)
at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:83)
at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:72)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)
at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:77)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
from spring-data-couchbase.
Michael Nitschinger commented
What about just storing it as a string?
from spring-data-couchbase.
Pavel Bernshtam commented
I had a map from Class to some object. It was stored successfully.
Yes, I save it as String now as workaround
from spring-data-couchbase.
Michael Nitschinger commented
Let's get this fixed for M3, the ENUMs should already be in M2.
from spring-data-couchbase.
David Harrigan commented
Hi,
Pull Request #19 created.
-=david=-
from spring-data-couchbase.
David Harrigan commented
Updated PR created
from spring-data-couchbase.
Michael Nitschinger commented
A proper fix has been merged into master, can you please verify there?
from spring-data-couchbase.
Related Issues (20)
- Application custom conversions override spring-data-couchbase custom conversions since v5 HOT 6
- Make CrudMethodMetadataPostProcessor public and make factory getTargetRepository() not final (so factory can be extended) HOT 2
- Upgrade to Maven Wrapper 3.9.6
- Upgrade to Maven Wrapper 3.9.6
- Upgrade to Maven Wrapper 3.9.6
- Release 5.1.8 (2023.0.8)
- Release 5.2.2 (2023.1.2)
- Native Build Fails When Couchbase Auditing is Enabled HOT 7
- Extend license header copyright years to 2024
- Extend license header copyright years to 2024
- Extend license header copyright years to 2024
- Extend license header copyright years to 2024
- Native executable run fails with Error creating bean with name 'couchbaseClusterEnvironment' HOT 7
- CouchbaseTransactionalTemplateCollectionIntegrationTests.replacePerson intermittent failure
- Release 5.1.9 (2023.0.9)
- Release 5.2.3 (2023.1.3)
- Bump Couchbase SDK to 3.5.2 for 5.3.0
- Set document expiration dynamically HOT 4
- Update Revved up by Develocity badge
- Update README, update Doc with Spring Boot Compatibility
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spring-data-couchbase.