Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Hibernate filter with EntityManager
PostPosted: Thu May 24, 2012 1:06 pm 
Newbie

Joined: Thu May 24, 2012 12:53 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.