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:
 
 @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

    Required Elements
    Modifier and Type
    Required Element
    Description
    The name of the entity view root through which it can be accessed in the entity view mappings.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    The condition expression to use for joining the entity view root.
    The class which provides the correlation provider for this entity view root.
    The entity class for which to create this entity view root.
    The expression to use to create this entity view root.
    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.
    The order to use for the elements for the limit.
  • Element Details

    • name

      String name
      The 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<?> entity
      The entity class for which to create this entity view root. Can be omitted if a expression() or correlator() is specified.
      Returns:
      The entity class
      Default:
      void.class
    • expression

      String expression
      The expression to use to create this entity view root. Can be omitted if a entity() or correlator() 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> correlator
      The class which provides the correlation provider for this entity view root. Can be omitted if a entity() or expression() is specified.
      Returns:
      The correlation provider
      Default:
      com.blazebit.persistence.view.CorrelationProvider.class
    • condition

      String condition
      The condition expression to use for joining the entity view root. It is illegal to use the condition when a correlator() 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 joinType
      The join type to use for the entity view root.
      Returns:
      The join type
      Default:
      LEFT
    • fetches

      String[] fetches
      The associations of the entity that should be fetched.
      Returns:
      The associations of the entity that should be fetched
      Default:
      {}
    • limit

      String limit
      The 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 offset
      The 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[] order
      The 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 like age 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:
      {}