我确实向 MySQL 数据库发出请求,它按条件搜索表中的数据:
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
但是我收到这样的错误:
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
最佳答案
如果您使用空集进行 in
搜索,通常会发生这种情况。这意味着您需要检查 HallsZones.findAllByCafee(cafee)
的大小,因为该集合可能为空。
关于mysql - Grails 中的 SQL 语法错误 MySQLSyntaxErrorException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30642845/