Two Laptop Bag*
The moose likes Groovy and the fly likes Gorm call Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Languages » Groovy
Bookmark "Gorm call" Watch "Gorm call" New topic
Author

Gorm call

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Hello everyone, I'm attempting to come up with a gorm statement that would ruffly do the following:

def criteria = "where LastName starts with "+someLetter
def persons = Persons.findAllByLastName(criteria)

I'm struggling with getting the syntax right for criteria. I'm attempting to search by the first letter of all last names in my db. If anybody knows the correct syntax for my criteria combination, could you please write a response? Thanks a lot.
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
I found something promising, but it still not working. Right now I have:

def criteria = "from Persons as p where p.LastName like ?"
def persons = Persons.findAll(criteria, [params.selected])

It returns an empty array so far.
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6




GenRocket - Experts at Building Test Data
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 134
Thanks so much, much appreciated!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Gorm call