As per the upgrade docs of grails 3.3.x (http://docs.grails.org/3.3.x/guide/upgrading.html)
GrailsDomainClass is deprecated with class PersistentEntity.java.
Now, I was trying to upgrade my grails application which was on 3.2.11 to 3.3.5
Here I removed all occurrences of GrailsDomainClass with PersistentEntity. Now when I try to call :
Example:
PersistentEntity persistentEntity = grailsApplication.getArtefacts("Domain")[0] as PersistentEntity;
println persistentEntity.relationshipMap
println persistentEntity.hasOneMap
It gives me groovy.lang.MissingPropertyException: No such property: relationshipMap for class: DefaultGrailsDomainClass1_groovyProxy
And,
groovy.lang.MissingPropertyException: No such property: hasOneMap for class: DefaultGrailsDomainClass1_groovyProxy
Can someone help me with the correct api to get relationshipMap and hasOneMap. I tried to search a lot regarding this but no success till now.
Thanks in advance!
I got the solution for this.
There is no direct api for this, But it can be accessed using:
Map hasOneMap = GrailsClassUtils.getStaticPropertyValue(persistentEntity.clazz, "hasOne") as Map
Map relationshipMap = GrailsClassUtils.getStaticPropertyValue(persistentEntity.clazz, "hasMany") as Map