Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think it's possible, some implementation ideas:</p> <p>I'd use DataSources Plugin + a custom DataSource class. You can use the DataSources Plugin to separate domain classes pointing to the master database and the customer specific database.</p> <p>For routing to the customer database, you could create your own DataSource class. I'd recommend extending the custom class from <a href="http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/jdbc/datasource/DelegatingDataSource.html" rel="nofollow noreferrer">org.springframework.jdbc.datasource.DelegatingDataSource</a> . The custom DataSource decides what target DataSource to use. You should make a pool of datasources, you could use commons.apache.org/pool/ to implement the pool. The pool of datasource can take care of closing the datasource (connection pool) after some inactivity time.</p> <p>You can use a ThreadLocal to tell the "pool of datasources" pool which customer is logged in and that information can be used to choose (or create on the fly) the correct target datasource. </p> <p>You'll have to turn off all Hibernate caching for customer specific classes unless you implement some specific Hibernate cache implementation (that should be possible using the same "routing idea" as in the DataSource).</p> <p>You can override the default dataSource beans in your resources.groovy with your custom versions, see DataSource Plugin faq (grails.org/plugin/datasources#faqTab).</p> <p>I'd recommend Tomcat JDBC Pool (JDBC-Pool Grails plugin: grails.org/plugin/jdbc-pool) as the DataSource / database pool implementation. BoneCP (jolbox.com/) looks promising too, but I haven't tested it.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload