Jump to: navigation, search

Difference between revisions of "EclipseLink/Examples/JPA/PessimisticLocking"

(New page: EclipseLink allows users the option of using pessimistic locking on their queries. This is done through the use of a query hint. == Via Annotations == <code><pre> @Entity @Table(name="JPA...)
 
(Via Annotations)
Line 8: Line 8:
 
   name="findEmployeeByPK",
 
   name="findEmployeeByPK",
 
   query="SELECT OBJECT(employee) FROM Employee employee WHERE employee.id = :id"),
 
   query="SELECT OBJECT(employee) FROM Employee employee WHERE employee.id = :id"),
   hints={@QueryHint(name=EclipseLinkQueryHints.PESSIMISTIC_LOCK, value=EclipseLinkQueryHints.PESSIMISTIC_LOCK)
+
   hints={
 +
    @QueryHint(
 +
      name=EclipseLinkQueryHints.PESSIMISTIC_LOCK,  
 +
      value=EclipseLinkQueryHints.PESSIMISTIC_LOCK)
 +
  }
 
)
 
)
 
public class Employee implements Serializable {
 
public class Employee implements Serializable {

Revision as of 15:21, 15 October 2007

EclipseLink allows users the option of using pessimistic locking on their queries. This is done through the use of a query hint.

Via Annotations

@Entity
@Table(name="JPA_EMPLOYEE")
@NamedQuery(
  name="findEmployeeByPK",
  query="SELECT OBJECT(employee) FROM Employee employee WHERE employee.id = :id"),
  hints={
    @QueryHint(
      name=EclipseLinkQueryHints.PESSIMISTIC_LOCK, 
      value=EclipseLinkQueryHints.PESSIMISTIC_LOCK)
  }
)
public class Employee implements Serializable {
...

}

Via XML