File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Groovy and the fly likes Gorm call Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Other Languages » Groovy
Reply Bookmark "Gorm call" Watch "Gorm call" New topic
Author

Gorm call

liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 115
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: 115
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
Sheriff

Joined: Jul 11, 2001
Posts: 15040




My Blog | DZone Articles
liliya woland
Ranch Hand

Joined: Apr 11, 2006
Posts: 115
Thanks so much, much appreciated!
 
 
subject: Gorm call
 
Threads others viewed
acegi security plugin, Person and one of my domain objects
Accessing contents of a jar file
[Grails] Passing user object into hiddenField
Question on GORM
Hibernate: Problem re-attaching existing objects to a new session
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com