grailsdnspersistent

Grails 4 how to test if domain class PersistentProperty is an assocation?


In earlier versions of Grails 3 there was a property "GrailsDomainClassProperty.association". I could use this to test whether a property was part of an association. In Grails 4 how do I use PersistentProperty to find this out? Is a property a simple type or an association - one-to-one, one-to-many, etc?


Solution

  • It looks like the answer is to get the PersistentEntity.associations list and check there as to whether an arbitrary property is in fact an assocation. There may be a better answer but that is what I'm going with.