Posted on 2010-05-23 04:57
leekiang 阅读(538)
评论(0) 编辑 收藏 所属分类:
grails
因为要处理遗留代码,需要在 gog 中使用手工事务, 在 resources.groovy 中进行如下定义后
-
testDataSourceTxManager(DataSourceTransactionManager){
-
dataSource = ref('dataSource')
-
}
testDataSourceTxManager(DataSourceTransactionManager){
dataSource = ref('dataSource')
}
发现 service 中的事务没了。
查了一下 Grails 的源码, 原来 grails 在进行事务管理器查找的时候,并不是用的 bean 名字去查找,而是查找 所有 是
TransactionManager 实例 的 Bean, 并从得到的数组中 取第一个作为事务管理器。
因此要使用 spring 的 DataSourceTransactionManager 的, 就不能将这个 Manager 在
Context 中定义了。只能通过自己 new 一个 单例的 DataSourceTransactionManager, 然后将
DataSource 传入,这样就可以用了..........
来源:http://phoenix-clt.javaeye.com/blog/430400
http://osdir.com/ml/lang.groovy.grails.user/2008-04/msg00663.html
How to operate the partition table with Hibernate & GORM
Sorry I had been on a business trip for a few days
Although the Hibernate Shards has some urgent limitations, like
'Cross-Shard
Object Graphs' , it is a wonderful solution for this. But the Hibernate
Shards has implemented its own Session/SessionFactory(etc.), maybe bring
GROM some troubles.
Thanks for your reply. And to look forward to that GROM can support
Hibernate Shards.
To take an advantage of the Spring JDBC Template for any Grail
application, the first thing you need to do, is to define the DataSource
bean in resources.groovy , Don't forget to have the jdbc driver(.jar)
corresponding to your backend database server under the lib folder of
your grail application.
http://www.rimple.com/tech/2010/3/25/calling-postgresql-stored-procedures-from-grails-part-1-the.html
http://www.blogjava.net/rain1102/archive/2008/07/18/215891.html