fr.umlv.javaodb
Enum PersistenceContext.Kind

java.lang.Object
  extended by java.lang.Enum<PersistenceContext.Kind>
      extended by fr.umlv.javaodb.PersistenceContext.Kind
All Implemented Interfaces:
Serializable, Comparable<PersistenceContext.Kind>
Enclosing interface:
PersistenceContext

public static enum PersistenceContext.Kind
extends Enum<PersistenceContext.Kind>

The kind of peristence context.


Enum Constant Summary
FAT_LOCK
          When the context is created, a lock is taken on the database.
LIGHT_LOCK
          Each time a value of an object given by PersistenceContext.findAll(Class), PersistenceContext.findById(long, Class) or PersistenceContext.create(Class) is read or written, a lock on that object is taken.
OPTIMISTIC
          Each time a value of an object given by PersistenceContext.findAll(Class), PersistenceContext.findById(long, Class) or PersistenceContext.create(Class) is modified, the context saves the old value.
 
Method Summary
static PersistenceContext.Kind valueOf(String name)
          Returns the enum constant of this type with the specified name.
static PersistenceContext.Kind[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

FAT_LOCK

public static final PersistenceContext.Kind FAT_LOCK
When the context is created, a lock is taken on the database. This lock is realease in case of an explicit rollback or a commit.


LIGHT_LOCK

public static final PersistenceContext.Kind LIGHT_LOCK
Each time a value of an object given by PersistenceContext.findAll(Class), PersistenceContext.findById(long, Class) or PersistenceContext.create(Class) is read or written, a lock on that object is taken. In case of deadlock a RollbackException is raised.


OPTIMISTIC

public static final PersistenceContext.Kind OPTIMISTIC
Each time a value of an object given by PersistenceContext.findAll(Class), PersistenceContext.findById(long, Class) or PersistenceContext.create(Class) is modified, the context saves the old value. During the commit, the context checks that any modified values was not changed by another context. If at least one value has changed a RollbackException is raised else all changes are commited atomically.

Method Detail

values

public static PersistenceContext.Kind[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (PersistenceContext.Kind c : PersistenceContext.Kind.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static PersistenceContext.Kind valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null


2006 - Université de Marne-la-Vallée