Package com.blazebit.persistence.view
Annotation Type EntityViewRoot
@Target(TYPE)
@Retention(RUNTIME)
@Repeatable(EntityViewRoots.class)
public @interface EntityViewRoot
Registers an entity view root for the annotated entity view.
A view root can be either defined through an entity class with a condition:
A view root can be either defined through an entity class with a condition:
@EntityViewRoot(
name = "root1",
entity = Document.class,
condition = "id = VIEW(documentId)"
)
an expression with an optional condition:
@EntityViewRoot(
name = "root2",
expression = "Document[id = VIEW(documentId)]",
condition = "root2.age > 10"
)
or through a correlator:
@EntityViewRoot(
name = "root3",
correlator = MyCorrelationProvider.class
)
Paths that are not fully qualified i.e. relative paths that use no root alias, are prefixed with the entity view root alias.- Since:
- 1.6.0
- Author:
- Christian Beikov
-
Required Element Summary
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionThe condition expression to use for joining the entity view root.Class<? extends CorrelationProvider>
The class which provides the correlation provider for this entity view root.Class<?>
The entity class for which to create this entity view root.The expression to use to create this entity view root.String[]
The associations of the entity that should be fetched.The join type to use for the entity view root.The maximum amount of elements to fetch for the annotated attribute.The amount of elements to skip for the annotated attribute.String[]
The order to use for the elements for the limit.
-
Element Details
-
name
String nameThe name of the entity view root through which it can be accessed in the entity view mappings.- Returns:
- The entity view root name
-
-
-
entity
Class<?> entityThe entity class for which to create this entity view root. Can be omitted if aexpression()
orcorrelator()
is specified.- Returns:
- The entity class
- Default:
- void.class
-
expression
String expressionThe expression to use to create this entity view root. Can be omitted if aentity()
orcorrelator()
is specified. Paths that are not fully qualified i.e. relative paths that use no root alias, are prefixed with the entity view root alias.- Returns:
- The expression
- Default:
- ""
-
correlator
Class<? extends CorrelationProvider> correlatorThe class which provides the correlation provider for this entity view root. Can be omitted if aentity()
orexpression()
is specified.- Returns:
- The correlation provider
- Default:
- com.blazebit.persistence.view.CorrelationProvider.class
-
condition
String conditionThe condition expression to use for joining the entity view root. It is illegal to use the condition when acorrelator()
was specified. Paths that are not fully qualified i.e. relative paths that use no root alias, are prefixed with the entity view root alias.- Returns:
- The condition expression
- Default:
- ""
-
joinType
JoinType joinTypeThe join type to use for the entity view root.- Returns:
- The join type
- Default:
- LEFT
-
fetches
String[] fetchesThe associations of the entity that should be fetched.- Returns:
- The associations of the entity that should be fetched
- Default:
- {}
-
limit
String limitThe maximum amount of elements to fetch for the annotated attribute. Can be an integer literal e.g.5
or a parameter expression:myParam
.- Returns:
- The limit
- Default:
- ""
-
offset
String offsetThe amount of elements to skip for the annotated attribute. Can be an integer literal e.g.5
or a parameter expression:myParam
.- Returns:
- The offset
- Default:
- ""
-
order
String[] orderThe order to use for the elements for the limit. This will not necessarily order the elements in a collection! The syntax is like for a JPQL.next order by item i.e. something likeage DESC NULLS LAST
. Paths that are not fully qualified i.e. relative paths that use no root alias, are prefixed with the entity view root alias.- Returns:
- order to use for the limit
- Default:
- {}
-