Results 1 to 3 of 3

Thread: Hib 3 Entity Caching Strats on LocalSessionFactoryBean

  1. #1
    Join Date
    Nov 2004
    Location
    Atlanta, GA, USA
    Posts
    42

    Default Hib 3 Entity Caching Strats on LocalSessionFactoryBean

    Do the caching strategies specified in LocalSessionFactoryBean over-ride any caching specifically stated within the HBM.XML files, or do the XML files take precedence?

  2. #2

    Default 2nd level caching

    The caching settings for the LocalSessionFactory bean are basically the same as if you had a non-spring managed session factory

    The entity and collection cache strategies settings on the LocalSessionFactory map to the class and collection settings..

    i.e.
    Code:
    <hibernate-configuration>
    
        <session-factory
            name="java&#58;hibernate/SessionFactory">
    
            <!-- properties -->
            . . .
    
            <!-- mapping files -->
            <mapping resource="org/hibernate/auction/Item.hbm.xml"/>
            <mapping resource="org/hibernate/auction/Bid.hbm.xml"/>
    
            <!-- cache settings -->
            <class-cache class="org.hibernate.auction.Item" usage="read-write"/>
            <class-cache class="org.hibernate.auction.Bid" usage="read-only"/>
            <collection-cache class="org.hibernate.auction.Item.bids" usage="read-write"/>
    
        </session-factory>
    
    </hibernate-configuration>

    I am not sure if / why you would mix and match SessionFactory and HBM level configuration... however I would assume it would be an "AND" situation.

  3. #3
    Join Date
    Nov 2004
    Location
    Atlanta, GA, USA
    Posts
    42

    Default

    Excellent. Thanks Mark.

Similar Threads

  1. Other Hibernate DAO LazyInitializationExceptions
    By bernardsirius in forum Data
    Replies: 5
    Last Post: Feb 18th, 2005, 04:09 PM
  2. Replies: 9
    Last Post: Feb 8th, 2005, 09:25 PM
  3. strategies for caching persistent data
    By news in forum Architecture
    Replies: 3
    Last Post: Jan 14th, 2005, 02:10 PM
  4. Entity bean
    By india in forum EJB
    Replies: 2
    Last Post: Dec 19th, 2004, 11:35 AM
  5. AOP/Attributes-based caching
    By alruiz15 in forum AOP
    Replies: 0
    Last Post: Oct 5th, 2004, 07:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •