1

When I am persisting my entity in my springboot application, I got this error.

"wrappedCdo is not an instance of given managedType 'TestClass' but 'TestClass'"

But, the error vanished when I restarted the application again. I have seen this happening before as well.

Any idea what must be causing this?

ndsurendra
  • 413
  • 1
  • 5
  • 15

1 Answers1

2

The question is old but for anyone who ends up here in the future, the issue is related to the class in question being loaded separately by different class loaders (Spring Boot utilizes an additional RestartClassLoader to support hot deploy of code changes), which breaks the type comparison. The issue is quite similar to the one reported here:

A classloader proplem related to spring-boot-devtools

And the solution is the same. In my case, I added the following line to src/main/resources/META-INF/spring-devtools.properties:

restart.include.javers=/javers.*.jar

This seems to solve the issue for JaVers.