title: JPA @Query annotation for update query (oracle sql developer) -- org.hibernate.exception.GenericJDBCException: could not execute query
body: <p>I have one repository file shared the source code for the same and one controller class through which I make a call to that @query function for one the update statement. I want to update one column data into my Oracle database for which I have written JPA update @query and defined the function into one of the repository files hence making a call from one of my controller class getting could not execute the query.</p>
  
  <p><strong>Repository file</strong></p>
  
  <pre><code>package com.sid.demo.repository;
  
  import java.util.List;
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.data.jpa.repository.Modifying;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.repository.query.Param;
  import com.sid.demo.model.hindalco_model;
  
  public interface update_password extends JpaRepository&lt;hindalco_model,Integer&gt; 
  {   
      @Query(value="update USER_REGISTRATION set password = :password WHERE user_name = :user_name and email = :email",nativeQuery=true)
      List&lt;String&gt; findbyuser_update(@Param("password") String password,String user_name,String email);   
  }
  </code></pre>
  
  <p><strong>Controller class</strong></p>
  
  <pre><code>@RequestMapping(value="/update_password",method = RequestMethod.POST)
      public String update_password(@RequestParam String password)
      {
          //String rnumber_verified=randomNumber;
          //int random_otp_verified=Integer.parseInt(rnumber_verified);
  
  
  
          //System.out.println("update query string value = "+hindalco_user_login12);
          System.out.println("user_name outside try = "+user_name12);
          System.out.println("email outside try = "+password12);
          try
          {
              System.out.println("user_inside try = "+user_name12);
              System.out.println("email inside try = "+password12);
  
              update_password_repo.findbyuser_update(password,user_name12,password12);
              return "Entered password successfully updated"; 
          }
          catch(Exception e)
          {
              return"Iam sorry entered password did not match "+e;
          }
  
      }
  </code></pre>
  
  <p><strong>Model Class</strong></p>
  
  <pre><code>package com.sid.demo.model;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.persistence.Table;
  
  
  @Entity
  @Table(name="user_registration")
  public class hindalco_model
  {
      @GeneratedValue(strategy=GenerationType.AUTO)
      @Id
      @Column(name="user_id")
      private int user_id;
  
      @Column(name="user_name")
      private String user_name;
  
      @Column(name="email")
      private String email;
  
      @Column(name="password")
      private String password;
  
      public int getUser_id() {
          return user_id;
      }
  
      public void setUser_id(int user_id) {
          this.user_id = user_id;
      }
  
      public String getUser_name() {
          return user_name;
      }
  
      public void setUser_name(String user_name) {
          this.user_name = user_name;
      }
  
      public String getEmail() {
          return email;
      }
  
      public void setEmail(String email) {
          this.email = email;
      }
  
      public String getPassword() {
          return password;
      }
  
      public void setPassword(String password) {
          this.password = password;
      }
  
  
  
      @Override
      public String toString() {
          return "hindalco_model [user_id=" + user_id + ", user_name=" + user_name + ", email=" + email + ", password="
                  + password +"]";
      }
  
  
  
  }
  </code></pre>
  
  <p>I just wanted to write JPA @query to update one of my column data and for that, I want to pass function call from controller class to that repository file which contains @query annotation function definition which will automatically get convert into hibernate query through the compiler and hence in oracle database the data will be updated. </p>