Skip to content

Commit

Permalink
Blazebit#312 - Documentation corrections as requested by Mobe91
Browse files Browse the repository at this point in the history
  • Loading branch information
beikov committed Apr 27, 2017
1 parent c4ecd32 commit 5e8aff0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ interface CatView extends NameView, AgeView {
}
----

In this example `CatView` has two attributes, `name` and `age`. Even though the interfaces aren't entity views, they could have custom mappings.
In this example `CatView` has two attributes, `name` and `age`. Even though the interfaces are not entity views, they could have custom mappings.

// TODO: Warn about equlas-hashCode implementations in abstract classes

Expand Down Expand Up @@ -1337,18 +1337,18 @@ public abstract class CatView {
}
}
----
<1> If the unsafe proxy is used, `getAge()` will return the actual value, otherwise will return `null`
<1> If the unsafe proxy is used, `getAge()` will return the actual value, otherwise it will return `null`

=== Inheritance mapping

Entity views can have an inheritance relationship to subtypes via an inheritance mapping. This relationship allows instances of an entity view subtype to be materialized when a selection predicate,
that is defined by an inheritance mapping, is satisfied.
Entity views can have an inheritance relationship to subtypes via an inheritance mapping. This relationship allows instances of an entity view subtype to be materialized when a selection predicate
defined by an inheritance mapping is satisfied.

The inheritance feature for an entity view is activated by annotating link:{entity_view_jdoc}/persistence/view/EntityViewInheritance.html[`@EntityViewInheritance`] on an entity view.
By default, all subtypes of the entity view are considered as inheritance subtypes and thus require a so called _inheritance mapping_.

A _inheritance mapping_ is defined by annotating the subtype with link:{entity_view_jdoc}/persistence/view/EntityViewInheritanceMapping.html[`@EntityViewInheritanceMapping`] and defining
a selection predicate that represents the condition on which is decided whether an instance of that subtype should be constructed. The predicate is a normal link:{core_doc}#expressions[JPQL predicate expression]
An _inheritance mapping_ is defined by annotating the subtype with link:{entity_view_jdoc}/persistence/view/EntityViewInheritanceMapping.html[`@EntityViewInheritanceMapping`] and defining
a selection predicate that represents the condition on which decides the instantiation of that subtype. The predicate is a normal link:{core_doc}#expressions[JPQL predicate expression]
and can refer to all attributes of the mapped entity type.

Consider the following example
Expand Down Expand Up @@ -1395,7 +1395,7 @@ LEFT JOIN cat.mother mother_1
LEFT JOIN cat.kittens kittens_1
----

The type index 0 refers to the base type `BaseCatView` and in this case instances of `BaseCatView` are materialized when the age of a result is exactly 18.
The type index 0 refers to the base type `BaseCatView`, hence instances of `BaseCatView` are materialized when the age of a result equals 18.

Since it might not be desirable to use all entity view subtypes for the inheritance relationship, it is possible to explicitly declare the subtypes in the `@EntityViewInheritance` annotation on the super type.

Expand All @@ -1412,7 +1412,7 @@ This has the effect, that only `BaseCatView` or `YoungCatView` instances are mat

=== Inheritance subview mapping

Similarly to specifying the entity view inheritance subtypes at the declaration site i.e. `BaseCatView` it is also possible to define subtypes at the _use site_ i.e. the subview attribute.
Similarly to specifying the entity view inheritance subtypes at the declaration site, i.e. `BaseCatView`, it is also possible to define subtypes at the _use site_, i.e. at the subview attribute.
By annotating the subview attribute with `@MappingInheritance`, it is possible to delimit and override the entity view subtype mappings that are considered for materialization from the result.
When using the `@MappingInheritance` annotation, it is required to list all desired subtypes via `@MappingInheritanceSubtype` annotations that can optionally override the inheritance mapping.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.lang.annotation.Target;

/**
* Specifies that the entity view when queried should consider subtypes of the entity view.
* Specifies that the entity view should consider subtypes of the entity view when queried.
*
* @author Christian Beikov
* @since 1.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public void visit(ParameterExpression expression) {
// NOTE: We use null as marker for ANY TYPE
currentPosition.setCurrentClass(null);
} else {
// If there are other branches(path positions) i.e. of a case when that have a type, we can allow parameters too
// If there are other branches (path positions) i.e. of a case when that have a type, we can allow parameters too
for (PathPosition position : pathPositions) {
if (position != currentPosition) {
if (position.getCurrentClass() != null) {
Expand Down

0 comments on commit 5e8aff0

Please sign in to comment.