views:

50

answers:

1

I have a method which has domain name as a String parameter.

def modelName="Equity"

I want to use it like

def results=modelName.findAll()

Please guide me!

+2  A: 
def packageName = 'com.myproject'
def modelName = "Equity"
def domainClass = grailsApplication.classLoader.loadClass("$packageName.$modelName")
def results = domainClass .findAll()
fabien7474
Its working!Thanks
Shekhar