spring-projects / spring-projects/spring-data-rest

Performing a "Modifying query" generates an error [DATAREST-125]

Open
#509 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: bug
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Thomas Darimont opened DATAREST-125 and commented

Github Author: RobyZ
Github Last-Updated: 2013-06-06T12:33:54Z
This issue was automatically imported from github

The execution of a "Modifying query", defined as follows:

public interface EventoCalendarioRepository extends JpaRepository<EventoCalendario, Integer> {
@Transactional
@Modifying
@Query("update EventoCalendario ec set ec.dataEstinzione = null, ec.ottemperato = false where ec.id = :id")
Integer resetStatoEvento(@Param("id") Integer id);
}

invoking the url with the GET method:
http://localhost:8080/laweb4/eventoCalendario/search/resetStatoEvento?id=55074

generates a response with error:
Request URL:http://client-wi7-rzu2:8080/laweb4/eventoCalendario/search/resetStatoEvento?id=55074
Request Method:GET
Status Code:400 Bad Request
Request Headersview source
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding:gzip,deflate,sdch
Accept-Language:it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Cookie:JSESSIONID=9436BEBA86AC23EA6286FB5F7C23A50F
Host:client-wi7-rzu2:8080
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/28.0.1500.37 Safari/537.36
Query String Parametersview sourceview URL encoded
id:55074
Response Headersview source
Connection:close
Content-Encoding:gzip
Content-Type:application/json
Date:Thu, 06 Jun 2013 12:17:20 GMT
Server:Apache-Coyote/1.1
Transfer-Encoding:chunked
Vary:Accept-Encoding

with this response:
{"cause":null,"message":"java.lang.ClassCastException@453fd696"}

N.B.
The command to update the db is successful


To me it seems a bug, what do you think?


Reference URL: https://api.github.com/repos/SpringSource/spring-data-rest/issues/104

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.