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

java中的sql语句,布布扣,bubuko.com

java中的sql语句

上一篇:数据库基础之-范式


下一篇:PostgreSQL、oracle、MySQL比较