alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Hibernate example source code file (ReadOnlyAccess.java)

This example Hibernate source code file (ReadOnlyAccess.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Hibernate tags/keywords

cacheexception, cacheexception, illegal, illegal, log, object, readonlyaccess, readonlyaccess, softlock, softlock, transactionalaccess, unsupportedoperationexception

The Hibernate ReadOnlyAccess.java source code

package org.hibernate.cache.infinispan.collection;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.SoftLock;
import org.infinispan.util.logging.Log;
import org.infinispan.util.logging.LogFactory;

/**
 * This defines the strategy for transactional access to collection data in a
 * Infinispan instance.
 * <p/>
 * The read-only access to a Infinispan really is still transactional, just with 
 * the extra semantic or guarantee that we will not update data.
 *
 * @author Chris Bredesen
 * @author Galder ZamarreƱo
 * @since 3.5
 */
class ReadOnlyAccess extends TransactionalAccess {
   private static final Log log = LogFactory.getLog(ReadOnlyAccess.class);

   ReadOnlyAccess(CollectionRegionImpl region) {
      super(region);
   }
   public SoftLock lockItem(Object key, Object version) throws CacheException {
      throw new UnsupportedOperationException("Illegal attempt to edit read only item");
   }

   public SoftLock lockRegion() throws CacheException {
      throw new UnsupportedOperationException("Illegal attempt to edit read only region");
   }

   public void unlockItem(Object key, SoftLock lock) throws CacheException {
      log.error("Illegal attempt to edit read only item");
   }

   public void unlockRegion(SoftLock lock) throws CacheException {
      log.error("Illegal attempt to edit read only item");
   }

}

Other Hibernate examples (source code examples)

Here is a short list of links related to this Hibernate ReadOnlyAccess.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.