Enhancements for Jakarta EE 12
Jakarta Data simplifies data access by allowing you to represent data with simple Java objects (entities), and define interfaces (repositories) with methods that perform operations on it.
Fluent Query Construction: The metamodel provides a fluent API for building restrictions dynamically. Developers can define reusable query fragments, conditionally apply filters, and construct criteria programmatically — all without sacrificing type safety.
List<Product> found = products.findAll(
Restrict.all(
_Product.type.equalTo(ProductType.PHYSICAL),
_Product.price.greaterThan(10.00f),
_Product.name.contains("Jakarta")
),
Order.by(
_Product.price.desc(),
_Product.name.asc()
)
);
Inclusion of projection with Record: A repository method can return a projection by having the result type be a Java record.
record ModelInfo(String model, String manufacturer, int designYear) {}
@Repository
public interface Cars extends BasicRepository<Car, String> {
@Find
Optional<ModelInfo> getModelInfo(@By(_Car.VIN) String vehicleIdNum);
}
Stateful Repository Operations Jakarta Data includes the concept of stateful repositories that manage entities according to a persistence context. A complete definition of a persistence context can be found in the Jakarta Persistence specification. Stateful repositories have their own lifecycle annotations that provide fine-grained control over entity state transitions such as persisting, merging, refreshing, detaching, and removing entities. Lifecycle annotations for stateful operations must not be intermixed with lifecycle annotations for stateless operations. Consequently, each repository is either stateful or or stateless. An example of a stateless repository follows:
@Repository
public interface Products extends DataRepository<Product, String> {
@Persist
void add(Product product);
@Merge
Product update(Product product);
@Remove
void delete(Product product);
@Refresh
void reload(Product product);
@Detach
void detach(Product product);
}
The Release Review Specification Committee Ballot concluded successfully on YYYY-MM-DD with the following results.
The ballot was run on the jakarta.ee-spec mailing list
The Specification Committee Ballot concluded successfully on 2025-03-24 with the following results.
| Representative | Representative for: | Vote |
|---|---|---|
| Kenji Kazumura | Fujitsu | +1 |
| Emily Jiang, Tom Watson | IBM | +1 |
| Ed Bratt, Dmitry Kornilov | Oracle | +1 |
| Andrew Pielage, Petr Aubrecht | Payara | +1 |
| David Blevins, Jean-Louis Monteiro | Tomitribe | no vote |
| Ivar Grimstad | EE4J PMC | +1 |
| Marcelo Ancelmo, Abraham Marin-Perez | Participant Members | +1 |
| Werner Keil | Committer Members | +1 |
| Jun Qian | Enterprise Members | +1 |
| Zhai Luchao | Enterprise Members | +1 |
| Total | 9 |
Non-binding Votes
| Representative | Representative for: | Vote |
|---|---|---|
| Angelo Rubini | Community | +1 |
| Total | 1 |
The ballot was run on the jakarta.ee-spec mailing list