title: Hibernate/JPA Update query fails
body: <p>Good afternoon,</p>
  
  <p>I don't know why this query is giving an exception, could someone please help me to understand?</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>@PUT
  @Path("/process")
  @Consumes(MediaType.APPLICATION_JSON)
  public Response processEreturn(List&lt;Long&gt; ereturns){
  
      EntityManager em = Utils.initEntityManager();
  
      Query q = em.createQuery("UPDATE ereturn e SET e.processedByShipper = true WHERE e.id = 111713");
  
      q.executeUpdate();
  
      return Response.ok().build();
  }
  </code></pre>
  
  <p><strong>Excepion</strong></p>
  
  <pre><code>SEVERE: Servlet.service() for servlet [jersey-servlet] in context with path [/returnitRest] threw exception [javax.persistence.TransactionRequiredException: Executing an update/delete query] with root cause
  javax.persistence.TransactionRequiredException: Executing an update/delete query
      at org.hibernate.query.internal.AbstractProducedQuery.executeUpdate(AbstractProducedQuery.java:1492)
      at returnitRest.EreturnResource.processEreturn(EreturnResource.java:954)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191)
      at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:200)
      at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493)
      at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415)   
  
  thank you very much
  </code></pre>