[KEYCLOAK-5726] - Fixes the parameter value when making queries

This commit is contained in:
Pedro Igor 2017-10-20 21:56:26 -02:00
parent 7dd7b6b984
commit bc12193c3c
2 changed files with 2 additions and 2 deletions

View file

@ -90,7 +90,7 @@ public class AlbumService {
@Path("{id}") @Path("{id}")
@Produces("application/json") @Produces("application/json")
public Response findById(@PathParam("id") String id) { public Response findById(@PathParam("id") String id) {
List result = this.entityManager.createQuery("from Album where id = :id").setParameter("id", id).getResultList(); List result = this.entityManager.createQuery("from Album where id = :id").setParameter("id", Long.valueOf(id)).getResultList();
if (result.isEmpty()) { if (result.isEmpty()) {
return Response.status(Status.NOT_FOUND).build(); return Response.status(Status.NOT_FOUND).build();

View file

@ -99,7 +99,7 @@ public class AlbumService {
@Path("{id}") @Path("{id}")
@Produces("application/json") @Produces("application/json")
public Response findById(@PathParam("id") String id) { public Response findById(@PathParam("id") String id) {
List result = this.entityManager.createQuery("from Album where id = " + id).getResultList(); List result = this.entityManager.createQuery("from Album where id = " + Long.valueOf(id)).getResultList();
if (result.isEmpty()) { if (result.isEmpty()) {
return Response.status(Status.NOT_FOUND).build(); return Response.status(Status.NOT_FOUND).build();