Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/hibernate/dialect/lock/LockingStrategy.java


1   package org.hibernate.dialect.lock;
2   
3   import org.hibernate.engine.SessionImplementor;
4   import org.hibernate.StaleObjectStateException;
5   import org.hibernate.JDBCException;
6   
7   import java.io.Serializable;
8   
9   /**
10   * A strategy abstraction for how locks are obtained in the underlying database.
11   * <p/>
12   * All locking provided implemenations assume the underlying database supports
13   * (and that the connection is in) at least read-committed transaction isolation.
14   * The most glaring exclusion to this is HSQLDB which only offers support for
15   * READ_UNCOMMITTED isolation.
16   *
17   * @see org.hibernate.dialect.Dialect#getLockingStrategy
18   * @since 3.2
19   *
20   * @author Steve Ebersole
21   */
22  public interface LockingStrategy {
23    /**
24     * Acquire an appropriate type of lock on the underlying data that will
25     * endure until the end of the current transaction.
26     *
27     * @param id The id of the row to be locked
28     * @param version The current version (or null if not versioned)
29     * @param object The object logically being locked (currently not used)
30     * @param session The session from which the lock request originated
31     * @throws StaleObjectStateException Indicates an optimisitic lock failure
32     * as part of acquiring the requested database lock.
33     * @throws JDBCException
34     */
35    public void lock(Serializable id, Object version, Object object, SessionImplementor session)
36    throws StaleObjectStateException, JDBCException;
37  }