2009-08-31 53 views
3

我有兩個Grails的服務器:Grails的Hibernate的Session只讀

  • 服務器 - 已唸到數據庫
  • 網絡/寫訪問 - 具有隻讀訪問數據庫,併爲每寫發送如何使網絡的域對象讀取只在一個地方(配置文件)的應用程序的整個運行,而不是寫緩存:「只讀」的服務器

問題的請求每個域類的映射。

回答

2

帕拉 - 措辭從http://www.nabble.com/database-read-only-td20360158.html

如果你有池=真正在DataSource.groovy中這將創建一個org.apache.commons.dbcp.BasicDataSource。您可以在BootStrap.groovy中設置defaultReadOnly屬性:

class BootStrap { 

     def dataSource 

     def init = { servletContext -> 
     dataSource.defaultReadOnly = true 
     } 

     def destroy = {} 
} 
2

Grails中使用[dataSourceUnproxied] 的1.3.7

代替[數據源]