Created
January 7, 2014 19:23
-
-
Save gokhanakgul/8305215 to your computer and use it in GitHub Desktop.
In a service or controller, you can add a dependency injection for the dataSource bean and use groovy.sql.Sql or JDBC directly if you're a masochist. :) by Burt Beckwith [http://stackoverflow.com/questions/4600729/grails-query-not-using-gorm/4600991#4600991]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovy.sql.Sql | |
class DataService { | |
def dataSource | |
void runQuery(...) { | |
def sql = new Sql(dataSource) | |
sql.eachRow('select * from foo') { row -> | |
... | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment