Repository: deltaspike Updated Branches: refs/heads/master ebb24accd -> 716640903
DELTASPIKE-1187 Introduce basic docs for entity graphs. Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/71664090 Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/71664090 Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/71664090 Branch: refs/heads/master Commit: 716640903c6c5af89c2b1bb5842b05eabb245f10 Parents: ebb24ac Author: John D. Ament <johndam...@apache.org> Authored: Thu Oct 27 21:09:44 2016 -0400 Committer: John D. Ament <johndam...@apache.org> Committed: Thu Oct 27 21:09:44 2016 -0400 ---------------------------------------------------------------------- documentation/src/main/asciidoc/data.adoc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/deltaspike/blob/71664090/documentation/src/main/asciidoc/data.adoc ---------------------------------------------------------------------- diff --git a/documentation/src/main/asciidoc/data.adoc b/documentation/src/main/asciidoc/data.adoc index 00dffa9..fc7cc5d 100644 --- a/documentation/src/main/asciidoc/data.adoc +++ b/documentation/src/main/asciidoc/data.adoc @@ -927,6 +927,21 @@ result of the list, or else `empty()`. Queries returning `Stream<T>` act as a simple wrapper for `query.getResultList().stream()` to give back the results. +=== Entity Graphs + +EntityGraphs are a feature added in JPA 2.1. The Data module supports entity graphs for query operations, where the results +will be limited based on a defined graph. This feature is only available if you are using a JPA 2.1 implementation. + +`@EntityGraph` can be used for either `fetch` or `load` operations, depending on the `EntityGraphType` used in the annotation. Most queries should use the `FETCH` option. + +==== Named Graphs + +Entity graphs can be selected by name. A `@NamedEntityGraph` should be defined already within your persistence context to leverage this. When this graph is referenced on a repository method, it will be applied to the query. + +==== Dyanmically built graphs + +If you want to dynamically build a graph, you can do that via the `paths` attribute of the annotation. The paths specified will be added as graph nodes. Each graph node will be used in the select. The format is the full path to the property, based on the property names. + == Transactions If you call any method expression, `@Query`-annotated method or a method