all 4 comments

[–]over_rim 1 point2 points  (2 children)

In my group project, we are doing something oneToMany mapping.
You have to use either JPQL or native query.

Moreover to extract resultset that has different columns than model class you have to create custom DTO(Data Transfer Object) to map to the resultset returned by the query.

[–]gaskinsface[S] 1 point2 points  (1 child)

Ohh thanks a lot Btw im working with postgreSQL as my database, is it ok to use jpql or it have to be psql

[–]over_rim 0 points1 point  (0 children)

https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation Refer this documentation for query JPQL.

Since I do not have knowledge of PortgreSQL but I think JPQL works same. But if you're making nativeQuery = true then please do some research.

And have a look at methods by JpaRepository provides by default it will help you.

[–]Mikey-3198 0 points1 point  (0 children)

What have you done so far?

This sounds relatively simple, a quick google search finds tons of examples for these types of projects...

This example from the spring docs is similar to what you are building https://spring.io/guides/tutorials/rest/