You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unable to update embedded class field. Tried with new entity (provided example), update only the field, tried to add (DirtyCheck annotation) as I saw in some other issue -> that will throw an exception. Relevant stacktrace is as follows:
java.lang.IllegalStateException: Either class [org.avora.lib.models.EmbeddedClass] is not a domain class or GORM has not been initialized correctly or has already been shutdown. Ensure GORM is loaded and configured correctly before calling any methods on a GORM entity.
at org.grails.datastore.gorm.GormEnhancer.stateException(GormEnhancer.groovy:467)
at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:298)
at org.grails.datastore.gorm.GormEnhancer.findStaticApi(GormEnhancer.groovy:294)
at org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encodeUpdate(PersistentEntityCodec.groovy:285)
at org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encodeUpdate(PersistentEntityCodec.groovy:203)
at org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encodeEmbeddedUpdate(PersistentEntityCodec.groovy:443)
at org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encodeUpdate(PersistentEntityCodec.groovy:251)
at org.grails.datastore.mapping.mongo.engine.codecs.PersistentEntityCodec.encodeUpdate(PersistentEntityCodec.groovy)
at org.grails.datastore.mapping.mongo.MongoCodecSession.flush(MongoCodecSession.groovy:158)
at org.grails.datastore.mapping.mongo.AbstractMongoSession.flush(AbstractMongoSession.java:74)
at org.grails.datastore.gorm.GormInstanceApi.doSave(GormInstanceApi.groovy:368)
at org.grails.datastore.gorm.GormInstanceApi.doSave(GormInstanceApi.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1217)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
at org.codehaus.groovy.runtime.InvokerHelper.invokePogoMethod(InvokerHelper.java:1011)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:994)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethodSafe(InvokerHelper.java:97)
at org.grails.datastore.gorm.GormInstanceApi$_save_closure5.doCall(GormInstanceApi.groovy:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
at groovy.lang.Closure.call(Closure.java:405)
at org.codehaus.groovy.runtime.ConvertedClosure.invokeCustom(ConvertedClosure.java:50)
at org.codehaus.groovy.runtime.ConversionHandler.invoke(ConversionHandler.java:122)
at com.sun.proxy.$Proxy112.doInSession(Unknown Source)
at org.grails.datastore.mapping.core.DatastoreUtils.execute(DatastoreUtils.java:319)
at org.grails.datastore.gorm.AbstractDatastoreApi.execute(AbstractDatastoreApi.groovy:40)
at org.grails.datastore.gorm.GormInstanceApi.save(GormInstanceApi.groovy:179)
at org.grails.datastore.gorm.GormEntity$Trait$Helper.save(GormEntity.groovy:153)
at org.grails.datastore.gorm.GormEntity$Trait$Helper$save$4.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135)
at org.mypackage.DomainClass.save(DomainClass.groovy)
at org.mypackage.DomainClass.save(DomainClass.groovy)
at org.grails.datastore.gorm.GormEntity$save.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
Environment Information
Operating System: macOS Catalina 10.15.4
GORM Version: 7.0.2.RELEASE
Grails Version (if using Grails): 4.0.1
JDK Version: 1.8.0_231
Example Application
TODO: link to github repository with example that reproduces the issue
The text was updated successfully, but these errors were encountered:
Update:
Setting grails.mongodb.engine=mapping
in application.properties seems to fix the issue. As far as I understood from documentation this will affect performance, so I am still looking for the correct solution to this.
I think the root problem is that it is assuming EmbeddedClass as PersistentEntity whereas it is NOT. So, if you either annotate the Embedded class with @grails.gorm.annotation.Entity or move it to the grails-app/domains folder.
Task List
Steps to Reproduce
Expected Behaviour
Ability to update embedded class field.
Actual Behaviour
Unable to update embedded class field. Tried with new entity (provided example), update only the field, tried to add (DirtyCheck annotation) as I saw in some other issue -> that will throw an exception. Relevant stacktrace is as follows:
Environment Information
Example Application
The text was updated successfully, but these errors were encountered: