hibernate - Spring Data JPA transitive query method -
is possible in spring data jpa create transitive query method? e.g. :
game entity:
public class game{ long id; @manytomany private set<user> users; }
user entity:
public class user{ long id; string lastname; @manytomany(mappedby = "users") private set<game> games; }
i tried create method: list<user> findgameusersbyidorderbylastname(long gameid);
in gamerepository
extending crudrepository
. want users
game
ordered lastname
. doesn't work. possible this?
you should use here @query:
@query("select u user u join u.games g g.id = :gameid order u.lastname") set<> custommethodname(@param("gameid") long gameid);
you can more info @query here
Comments
Post a Comment