pragmus
pragmus

Reputation: 4043

Error in SQL syntax MySQLSyntaxErrorException in Grails

I do request to MySQL database, which searches data in table by criteria:

def tableAcounting(){
    def user = Person.findByUsername(springSecurityService.currentUser.username)
    def cafee = user.cafee
    def tablesQuery = TablePlacesInfo.createCriteria()
    def tables = tablesQuery.list {            //AN ERROR SHOW ON THIS STRING
        'in'("hall", HallsZones.findAllByCafee(cafee))
    }
    def halls = cafee.halls

But I get such error:

Class:com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException
Message:You have an error in your SQL syntax; 
check the manual that corresponds to your MySQL server version
for the right syntax to use near ')' at line 1

Upvotes: 2

Views: 437

Answers (1)

Chris
Chris

Reputation: 8109

This usually happends if you do an in search using an empty set. This means, that you need to check the size of HallsZones.findAllByCafee(cafee) because this set is probably empty.

Upvotes: 4

Related Questions