mvinas1977 opened a new issue, #14572:
URL: https://github.com/apache/grails-core/issues/14572

   I found something that looks like a gorm issue
   
   I have this simple model
   
   ```
   abstract class BaseDomain {
       User createdBy
   
       static constraints = {
           createdBy(nullable: false)
       }
   }
   
   class User extends BaseDomain {
   
       String userName
       User supervisor
   
       static constraints = {
       }
   
       static mappedBy = [
           createdBy: null
       ]
   }
   
   class Data extends BaseDomain {
   
       String otherField
   }
   ```
   If you look user it has this mappedBy closure
   
       static mappedBy = [
           createdBy: null
       ]
   because I don't want to have createdBy mapped automatically to the user set 
in supervisor, we really have a listener to set it.
   
   I need to know if the property createdBy is an association or not, so I do:
   
   ```
   def app = Holders.getGrailsApplication()
   GrailsDomainClass dc = app.getArtefact(DomainClassArtefactHandler.TYPE, 
Data.name)
    assert dc.getPersistentProperty(propertyName).isAssociation()
   ```
   It returns false when it should return true, if User has no mappedBy 
closure, it works fine
   
   I have an application shared with this domain classes and a couple of tests 
cases to reproduce this error if you like use it 
   
   
[https://github.com/mvinas1977/gorm-association-issue](https://github.com/mvinas1977/gorm-association-issue)
   
   **this happens in grails 2.5.6 I didn't test it in grails 3.3.x yet**


-- 
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]

Reply via email to