Specification
https://github.com/jakartaee/data/blob/main/spec/src/main/asciidoc/repository.asciidoc#type-safe-access-to-entity-attributes
I need clarification on ...
Hello,
I'm reaching out to discuss and understand the specific rationale behind the field type restrictions outlined in the documentation/specification, which states:
The metamodel class can contain one or more fields of type java.lang.String or jakarta.data.metamodel.Attribute (or Attribute subclasses from the jakarta.data.metamodel package)
the field type must be java.lang.String, jakarta.data.model.Attribute, or an Attribute subclass from the jakarta.data.metamodel package.
This constraint limits the model's extensibility, especially when attempting to develop specializations that accommodate various criteria conditions, such as those applicable to NoSQL databases.
For context, I want to create specialized attributes that could directly handle more granular query logic within the type system. An example of such a specialization might be:
public interface BooleanAttribute<T> extends SortableAttribute<T> {
CriteriaCondition isTrue();
CriteriaCondition isFalse();
}
And applying this to an entity like this:
@Entity
public class Person {
@Id
private String id;
@Column
private String name;
@Column
private Boolean active; // Intended to utilize BooleanAttribute for advanced querying
}
My goal is to enable more expressive queries directly through the metamodel, such as:
_Person.active.isFalse();
However, the restriction above prevents the implementation of such extensions, potentially limiting the framework's utility for complex or specialized use cases.
Additional information
No response
Specification
https://github.com/jakartaee/data/blob/main/spec/src/main/asciidoc/repository.asciidoc#type-safe-access-to-entity-attributes
I need clarification on ...
Hello,
I'm reaching out to discuss and understand the specific rationale behind the field type restrictions outlined in the documentation/specification, which states:
This constraint limits the model's extensibility, especially when attempting to develop specializations that accommodate various criteria conditions, such as those applicable to NoSQL databases.
For context, I want to create specialized attributes that could directly handle more granular query logic within the type system. An example of such a specialization might be:
And applying this to an entity like this:
My goal is to enable more expressive queries directly through the metamodel, such as:
However, the restriction above prevents the implementation of such extensions, potentially limiting the framework's utility for complex or specialized use cases.
Additional information
No response