[jboss-user] [JBoss Seam] - Re: Data separation in multi tenant applications with seam

DavidInTx do-not-reply at jboss.com
Fri May 25 10:49:44 EDT 2007


Regarding option #1--you probably don't want to simply include a "where client id = ?" in all your queries--what if you forget in once place, and expose data improperly?

Instead, look at the restricted entity manager in the wiki example, which applies a filter to all queries that use it.  The configuration of the restricted entity manger is in components.xml, as follows:

    <core:managed-persistence-context name="restrictedEntityManager"
                                      auto-create="true"
                                      entity-manager-factory="#{wikiEntityManagerFactory}">
        <core:filters>#{accessLevelFilter}</core:filters>
    </core:managed-persistence-context>


Setting up a filter is described starting on page 540 of the Java Persistence with Hibernate book--I highly recommend it.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4048703#4048703

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4048703



More information about the jboss-user mailing list