code: private static PersistentProperty getGrailsDomainClassProperty(AbstractHibernateDatastore datastore, Class<?> targetClass, String propertyName) {
          PersistentEntity grailsClass = datastore != null ? datastore.getMappingContext().getPersistentEntity( targetClass.getName()) : null;
          if (grailsClass == null) {
              throw new IllegalArgumentException("Unexpected: class is not a domain class:"+targetClass.getName());
          }
          return grailsClass.getPropertyByName(propertyName);
      }
docs: Get hold of the GrailsDomainClassProperty represented by the targetClass' propertyName,
  assuming targetClass corresponds to a GrailsDomainClass.