title: Spring MVC Application syntax error
body: <p>I have this question:</p>
  
  <p><a href="https://stackoverflow.com/questions/31820342/spring-mvc-application/31821138?noredirect=1#comment51570131_31821138">Spring MVC application</a></p>
  
  <p>I solved with some new code, making <em>StudentDeleteRepository.java</em> and <em>StudentDeleteRepositoryImpl.java</em> and adding the tags as a user suggested:</p>
  
  <pre><code>@Autowired
  private StudentDeleteRepository studentDeleteRepository;
  
  
  @Transactional
  public Student delete(Student student) {
      return studentDeleteRepository.save(student);
  }
  </code></pre>
  
  <p><em>StudentDeleteRepository.java</em> gives the error:</p>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDeleteController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.github.elizabetht.service.StudentDeleteService com.github.elizabetht.controller.StudentDeleteController.studentDeleteService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDeleteService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.github.elizabetht.repository.StudentDeleteRepository com.github.elizabetht.service.StudentDeleteServiceImpl.studentDeleteRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'studentDeleteRepository': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: from near line 1, column 10 [delete s from com.github.elizabetht.model.Student s where s.userName = :userName and s.password = :password]</p>
  </blockquote>
  
  <p>Here is the class <em>StudentDeleteRepositoryImpl.java</em>:</p>
  
  <pre><code>package com.github.elizabetht.repository;
  
  import org.springframework.data.jpa.repository.JpaRepository;
  import org.springframework.data.jpa.repository.Query;
  import org.springframework.data.repository.query.Param;
  import org.springframework.stereotype.Repository;
  
  import com.github.elizabetht.model.Student;
  
  @Repository("studentDeleteRepository")
  public interface StudentDeleteRepository extends JpaRepository&lt;Student, Long&gt; {
  
      @Query("delete s from Student s where s.userName = :userName and s.password = :password")
      Student deleteByLogin(@Param("userName") String userName, @Param("password") String password);
  
  }
  </code></pre>