Monday, April 2, 2012

Grails Domain class reflection on properties

If you want to determine what the persistent fields are for a domain class at runtime using reflection, try the following:

         DefaultGrailsDomainClass dgdc = new DefaultGrailsDomainClass(clazz)
         logger.info("properties="+dgdc.getPersistentProperties())

1 comment:

  1. Great strategy! Well, for me it’s very important to know more about this. Thanks for sharing this and keep on posting.

    Maurice | Philippine web developer

    ReplyDelete