Posted By

skurt on 07/27/11


Tagged

console grails


Versions (?)

running sql in grails console


 / Published in: Groovy
 

  1. import groovy.sql.Sql
  2. def service = ctx.getBean("userService")
  3. def dataSource = ctx.dataSource
  4. def db = new Sql(dataSource)
  5. def result = db.rows("""(SELECT id, points FROM user WHERE points <= 100 ORDER BY points DESC LIMIT 5)""")

Report this snippet  

You need to login to post a comment.