Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save saqibmehmoodgit/8a5dcfaca268d2acf8a5d80848bb3ed7 to your computer and use it in GitHub Desktop.
Save saqibmehmoodgit/8a5dcfaca268d2acf8a5d80848bb3ed7 to your computer and use it in GitHub Desktop.
version 1 version 2 version 3
@Entity public class UserPost public class UserInstitute
public class User { {
{ String name; String name;
String name; List<Post> post ; List<Insitiute> insitute;
List<Post> post ; } }
List<Insitiute> insitute;
}
"select from User u fetch join u.post where id = 1"
it will result in inner join query so correct but
when i return User from Rest controller than it put
another query for institute whihc is unnecessary .so i make
Dto and use map struct to solve my problem (version 2).
Than i need User and Institute and i make another DTO (version 3).
My question is that if i need just User than make another DTO? and
If need User , Post , Institue togather than make another DTO ?
Please help to solve problem .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment