dularion opened a new issue, #14498: URL: https://github.com/apache/grails-core/issues/14498
### Expected Behaviour / Actual Behaviour We have several domains, some with inheritance, many with traits, lots and lots of hasManys. Often we try to serialize them in some way, for JSON responses or when we convert them to a Map in order to index them as Documents into Elasticsearch, during which we call referenced domains, fetch their name and status etc, use where-statements, etc etc.. And then for some domains, the exception appears `bytecode enhancement failed` ([stacktrace](https://gist.github.com/dularion/8398273d5a213832465149f03f21b64e)), and it did not appear Grails 3. We noted that this most often happens during where-statements (but not all of them) or when calling nested properties on referenced domains (but not all of them). However, when it happens for a certain Domain, it happens consistently. It also points us to a line within that Domain, but even if we remove that for test-purposes, it just goes to the next line and the next until, if there is no property left to point to, it just shows a generic vers ion of the same exception. Do you know what might cause this? we found [here](https://docs.jboss.org/hibernate/orm/5.0/topical/html/bytecode/BytecodeEnhancement.html) that that if we add `@ManagedEntity` it resolves the issue, but are we supposed to add that to every domain? how likely is that to break other stuff? We couldn't find a lot of info on this Annotation and we are scared of using it in our Production Applikation before we understand it better. Also, Its not added in Domains in new grails 4 projects using the create-app command, either, so why does our application break without it? ### Steps to Reproduce Unfortunately, we have not been able to reproduce this on in a new & fresh Grails4 Project, if necessary, we can try to piece something together, but it wont be easy, because it is happening for a pretty large application of ours that has many moving bits and pieces, all of which could have an impact on this. ### Environment Information - **Operating System**: Mac / Linux / Windows (different developers can reproduce it on their OS) - grailsVersion=4.1.0.M2 - groovyVersion=3.0.5 - gorm.version=7.1.0.M3 - gradleWrapperVersion=5.6 - **JDK Version:** JDK8 We really hope you can shed some light on this issue, and maybe point us to some docs on ManagedEntity that explain why that might be necessary in certain cases -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
