-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Can I use a 2nd level cache with multiple entity managers?
PostPosted: Fri Mar 10, 2006 2:02 pm 
Newbie

Joined: Wed Dec 07, 2005 2:01 pm
Posts: 8
Need help with Hibernate? Read this first:
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version:

Mapping documents:

<property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:

Hello. I have an application that has multiple entity managers to different databases with the same schema. Thry all use the same bean classes and are setup to use ehcache. The second level cache is working fine.

The problem is if I ever change entitymanagers on the fly, the cache seems to be filled with objects from the previous em. I thought that 2nd level caching was at a factory level, but it looks like it is shared with all the em instances. Is there something I can set to get each em to use it's own 2nd level cache?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 12, 2006 5:11 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Define different region prefixes
hibernate.cache.region_prefix

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 13, 2006 12:43 pm 
Newbie

Joined: Wed Dec 07, 2005 2:01 pm
Posts: 8
That worked!

Thanks a lot, emmanuel. I really appreciate all the hard work you guys do.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 19, 2006 5:16 pm 
Regular
Regular

Joined: Tue Dec 09, 2003 2:39 pm
Posts: 106
Location: Toronto, Canada
You may also want to consider a different cache-provider that is non-singleton-based.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

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.