Skip to content

Commit 8f40ef2

Browse files
Entity in Spring projection with no association
1 parent 59f21aa commit 8f40ef2

File tree

1 file changed

+5
-5
lines changed
  • HibernateSpringBootDtoEntityViaProjectionNoAssociation

1 file changed

+5
-5
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
**[Entity Inside Spring Projection (no association)](https://github.com/AnghelLeonard/Hibernate-SpringBoot/tree/master/HibernateSpringBootDtoEntityViaProjectionNoAssociation)**
22

3-
**Description:** If, for any reason, you need an entity in your Spring projection (DTO), then this application shows you how to do it via an example. In this case, there are two entities, `Author` and `Book`, that have no materialized association between them, but, they share the `genre` attribute. We use this attribute to join authors with books via JPQL. And, we want to fetch in a Spring projection the authors as entities, `Author`, and the `title` of the books.
3+
**Description:** If, for some reason, you need an entity in your Spring projection (DTO), then this application shows you how to do it via an example. In this case, there are two entities, `Author` and `Book`, that have no materialized association between them, but, they share the `genre` attribute. We use this attribute to join authors with books via JPQL. And, we want to fetch in a Spring projection the authors as entities, `Author`, and the `title` of the books.
44

5-
**Key points:**\
6-
- define two unrelated entities (e.g., `Author` and `Book`)\
7-
- define the proper Spring projection having `public Author getAuthor()` and `public String getTitle()`\
8-
- write a JPQL to fetch data
5+
**Key points:**
6+
- define two unrelated entities (e.g., `Author` and `Book`)
7+
- define the proper Spring projection having `public Author getAuthor()` and `public String getTitle()`
8+
- write a JPQL to fetch data
99

1010
<a href="https://leanpub.com/java-persistence-performance-illustrated-guide"><p align="center"><img src="https://github.com/AnghelLeonard/Hibernate-SpringBoot/blob/master/Java%20Persistence%20Performance%20Illustrated%20Guide.jpg" height="410" width="350"/></p></a>

0 commit comments

Comments
 (0)