-->
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.  [ 2 posts ] 
Author Message
 Post subject: Default 2nd level cache region for entities and collections
PostPosted: Mon Jan 21, 2008 9:21 am 
Beginner
Beginner

Joined: Thu Apr 27, 2006 5:49 am
Posts: 31
I've been reading Hibernate in action book and found out that I can configure 2nd level cache regions for each class and collection. Book says that I need to create a region with a "special" name and I could tune 2nd level cache expiration there.

The question is how to understand which region name to use? In Hibernate in action they used a full name of the class with the namespace. And for collections they just added the name of the collection. Is it the same in NHibernate? Is this example is valid? (I am using SysCache provider for the 2nd level cache)

Code:
    public namespace MyNamespace
    {
        public class MyEntity
        {
             public IList<int> MyCollection;
        }
    }

   <syscache>
      <cache region="MyNamespace.MyEntity" expiration="20" priority="3"/>
      <cache region="MyNamespace.MyEntity.MyCollection" expiration="10" priority="1"/>
   </syscache>


And another question is about using concurrency strategy. The book says that I can use a file with the name hibernate.cfg.xml to set concurrency strategies for the each class and collection. Is the naming is the same (Namespace.ClassName[.Collection])?

Can I use both web.config and hibernate.cfg.xml? I would like to use web.config for main parameters like connection string, providers and so on and hibernate.cfg.xml just for 2nd level cache tuning.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 21, 2008 9:55 am 
Beginner
Beginner

Joined: Thu Apr 27, 2006 5:49 am
Posts: 31
Btw, what region is used by default while caching queries/criterias results? I know I can set region explicitly, but if I don't? What region is used?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.