Hi,
I use springdata JPA with Hibernate 3.5.6 and want to implement multi-tenancy. The difference between tenant is in tenant_id field in each entity. What I actually need is to run my select queries always with where tenant_id=XXX expression. I hoped to get it using Spring-AOP aspect for all findXXX methods provided by Spring data JPA. I've configured it with @Before annotation to enable filtering and put the correct tenant into it. I see it working via JUnit but when I start the entire server I get java.lang.IllegalStateException: No transactional EntityManager available. Do you have any idea of how to solve this? Should I think about another solution for getting the result that I need?
Thanks in advance, Boris
|