|
|
This post has NOT been accepted by the mailing list yet.
Hi,
Apologies in advance for the newbie question but I'm trying to implement a search with HQL and my params field back to the controller is passing null:
DomainClass:
class Emcint_ach_edi_payments {
static searchable = true
static constraints = {
emc_country(blank:false)
file_type(blank:false)
creation_date(blank:false)
bank_account_num()
file_reference()
}
String emc_country
String file_type
Date creation_date
String bank_account_num
String file_reference
}
list.gsp:
<g:form name="searchForm"> <input type="text" value="searchQuery"/> <g:actionSubmit value="Search By Reference" action="refSearch"/> </g:form>
Controller:
class Emcint_ach_edi_paymentsController {
def scaffold = Emcint_ach_edi_payments
def refSearch = {
def payList = Emcint_ach_edi_payments.findAll("from Emcint_ach_edi_payments as b " +
"where b.file_reference like ?",["%${params.searchQuery}%"])
render(view:'list',model:[payList: payList])
println("%${params.searchQuery}%")
println("${payList}")
}
}
Output to console:
null
[]
Using the above setup the params.searchQuery is passing null back to the controller which is causing a null list output. The backend DB is Oracle 9i but dont think that should matter.
Any help would be greatly appreciated & thanks again
|