EclipseLink/Release/2.5/JPA21

From Eclipsepedia

< EclipseLink‎ | Release
Revision as of 14:53, 2 May 2013 by Peter.krogh.oracle.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

EclipseLink JPA 2.1

This page contains a summary of the major features supported in EclipseLink that implements the JPA 2.1 (JSR 338) specification requirements. The features and examples on this page do not represent a complete list. For more information, please see: the JSR 338 page.


Bulk Update

Until JPA 2.1, performing deletes or updates was not available using the Criteria API. Through the addition of CriteriaUpdate/CriteriaDelete classes, support for bulkupdate/delete queries has now been added.

The following example will update all the salaries of the Employees who make less than 10000$, and give them a raise.

  CriteriaUpdate<Employee> q = cb.createCriteriaUpdate(Employee.class);
  Root<Employee> emp = q.from(Employee.class);
  q.set(emp.get(Employee_.salary), 10000)
  .where(cb.lt(emp.get(Emploee_.salary), 10000));


The following Java Persistence query language update statement is equivalent.

  UPDATE Employee e SET e.salary = 10000 WHERE e.salary < 10000