Package jakarta.data.model
package jakarta.data.model
A static metamodel for entities that are used in Jakarta Data repositories.
The StaticMetamodel
allows for type-safe operations that avoid the
need to hard-code entity attribute names as Strings. For example,
@Entity public class Product { @Id public long id; public String name; public float price; } @StaticMetamodel(Product.class) public class Product_ { public static final Attribute id = Attribute.get(); public static final Attribute name = Attribute.get(); public static final Attribute price = Attribute.get(); } ... @Repository Product products; ... Pageable pageRequest = Pageable.ofSize(20) .sortBy(Product_price.desc(), Product_name.asc(), Product_id.asc()); page1 = products.findByNameLike(namePattern, pageRequest);
-
ClassDescriptionRepresents an entity attribute in the
StaticMetamodel
.Implemented by the Jakarta Data provider toinitialize
an attribute field in theStaticMetamodel
.Annotates a class to serve as a static metamodel for an entity, enabling type-safe access to entity attribute names and related objects, such asSort
s for an attribute.