In this example, I assume your domain class name is 'Research' and the full package name is 'com.package.name.Research'
Way 1:
Way 2:
Way 1:
Research.declaredFields.each{
if(!it.synthetic)
println it.name
}
Way 2:
def names = grailsApplication.getDomainClass('com.package.name.Research').persistentProperties.collect {
println it.name
}
Way 3: def Research domainClass = grailsApplication.getGrailsDomainClass('Research')
def persistentProperties = domainClass.getPersistentProperties()
persisentProperties.each { property ->
println property
}
No comments:
Post a Comment