[ 转载 ]grails 调用存储过程( Grails : calling a stored procedure ) 在特殊情况下,grails 应用需要调用数据库的存储过程,这在 grails 的官方文档里边好像没有提到过,在 james 的 blog 里介绍如何解决这个问题
代码转贴如下 java 代码 1
class MainController { 2
def dataSource // using the datasource we define in the spring's resources
def index = { 6
Sql sql = new Sql(dataSource) 7
def row = sql
execute("call create_daily_hours(${new Date()+1})") 8
} 需要说明的一些是:grails 本身没有提供访问存储过程的便捷方法,而groovy 的 GSQL 提供了,因此 grails 可以直接拿过来用了,当然也可以用 spring的 JdbcTemplate
希望对 grails 用户有点用
原文地址:http://grails
javaeye
com/group/blog/86666My experience with grails is getting richer the longer I use it for web application developing
It's very nice that grails is built on top of spring framework which we can take advantage of
I am not a spring user before but with