MDA/MDD/TDD/DDD/DDDDDDD
          posts - 536, comments - 111, trackbacks - 0, articles - 0
            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

          grails與jdbc

          Posted on 2010-05-23 04:57 leekiang 閱讀(548) 評論(0)  編輯  收藏 所屬分類: grails

          因為要處理遺留代碼,需要在 gog 中使用手工事務, 在 resources.groovy 中進行如下定義后

          1. testDataSourceTxManager(DataSourceTransactionManager){??
          2. ????dataSource?=?ref('dataSource')??
          3. }??

          ?發(fā)現(xiàn) service 中的事務沒了。

          ?查了一下 Grails 的源碼, 原來 grails 在進行事務管理器查找的時候,并不是用的 bean 名字去查找,而是查找 所有 是 TransactionManager 實例 的 Bean, 并從得到的數(shù)組中 取第一個作為事務管理器。

          ?因此要使用 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.aygfsteel.com/rain1102/archive/2008/07/18/215891.html


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導航:
           
          主站蜘蛛池模板: 桐庐县| 屯门区| 翼城县| 奇台县| 阜康市| 嘉鱼县| 建德市| 奉节县| 金门县| 镇远县| 偏关县| 星子县| 瑞昌市| 即墨市| 清远市| 新蔡县| 永善县| 苍溪县| 砚山县| 灵山县| 郑州市| 松江区| 彭泽县| 肥乡县| 双柏县| 连城县| 西宁市| 鱼台县| 大田县| 新营市| 错那县| 孟津县| 同德县| 鄂尔多斯市| 远安县| 沐川县| 玛沁县| 岫岩| 红桥区| 枞阳县| 湖北省|