File tree 3 files changed +5
-3
lines changed
data-jpa/src/main/java/com/example/data/jpa
3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 22
22
23
23
public interface BookRepository extends ListCrudRepository <Book , Long > {
24
24
25
- @ EntityGraph (value = "Book.authors" )
25
+ // @EntityGraph(value = "Book.authors")
26
26
@ Query ("SELECT b FROM Book b WHERE b.title = :title" )
27
27
Book findByTitleWithNamedGraph (String title );
28
28
Original file line number Diff line number Diff line change @@ -73,7 +73,8 @@ private void entityGraph() {
73
73
book .getAuthors ().add (author );
74
74
bookRepository .save (book );
75
75
76
- Book loaded = bookRepository .findByTitleWithNamedGraph ("Spring in Action" );
76
+ // Book loaded = bookRepository.findByTitleWithNamedGraph("Spring in Action");
77
+ Book loaded = bookRepository .findByTitleWithAdHocGraph ("Spring in Action" );
77
78
System .out .println ("namedEntityGraph: " + loaded );
78
79
}
79
80
Original file line number Diff line number Diff line change 13
13
import jakarta .persistence .OneToMany ;
14
14
15
15
@ Entity
16
- @ NamedEntityGraph (name = "Book.authors" , attributeNodes = @ NamedAttributeNode ("authors" ))
16
+ // @NamedEntityGraph(name = "Book.authors", attributeNodes =
17
+ // @NamedAttributeNode("authors"))
17
18
public class Book {
18
19
19
20
@ Id
You can’t perform that action at this time.
0 commit comments