java中的sql语句

User.findAll("from User u where u.userId = ?", [ "joe" ])
User.findAll("from User u where u.userId = :uid", [ uid: "joe" ])
User.findAll("from User u where u.userId like :uid",[ uid: "j%", max:params.max, offset: params.offset ] )
 
def users = User.list([sort: 'userId', order: 'asc',max: 5, fetch: [posts: 'eager']])
 
domainClassName.createCriteria().list(){
    or{
 eq('status',"提交")
 eq('status',"完成")
 eq('status',"拒绝")
    }
   'in'()
   nq()
   like()
 
 
domainClassName.executeQuery("update domainClassName set synchro=true where synchro =:synchro data_year =:data_year and data_month =:data_month", [synchro: true, data_year: data_year, data_month: data_month]);
如果是删除的hql,也是executeUpdate
原文地址:https://www.cnblogs.com/zhouweiye/p/3594236.html