title: nested exception is org.springframework.dao.InvalidDataAccessResourceUsageException-could not execute query(Spring and Hibernate)
body: <p>Hi i am Developing Curd operation using spring while running i am getting this Exception <strong>could not execute query org.hibernate.exception.SQLGrammarException</strong>  can any one help me out.</p>
  
  <p>MyEntity:</p>
  
  <pre><code>@Entity
  @Table(name = "person")
  public class Person {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
       Long id;
      @Column
      String fname;
      @Column
      String lname;
      @Column
      int age;
      @Column
      float salary;
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getFname() {
          return fname;
      }
  
      public void setFname(String fname) {
          this.fname = fname;
      }
  
      public String getLname() {
          return lname;
      }
  
      public void setLname(String lname) {
          this.lname = lname;
      }
  
      public int getAge() {
          return age;
      }
  
      public void setAge(int age) {
          this.age = age;
      }
  
      public float getSalary() {
          return salary;
      }
  
      public void setSalary(float salary) {
          this.salary = salary;
      }
  
      @Override
      public String toString() {
          return "Id: " + id + "; fname : " + fname + "' age : " + age + "; Salary: " + salary;
      }
  }
  </code></pre>
  
  <p>applicationContext.xml:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:p="http://www.springframework.org/schema/p"
         xmlns:aop="http://www.springframework.org/schema/aop"
         xmlns:tx="http://www.springframework.org/schema/tx"
         xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd"&gt;
  
      &lt;bean id="propertyConfigurer"
            class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"
            p:location="/WEB-INF/jdbc.properties" /&gt;
  
      &lt;bean id="dataSource"
            class="org.apache.commons.dbcp.BasicDataSource"
            destroy-method="close"
            p:driverClassName="${jdbc.driverClassName}"
            p:url="${jdbc.url}"
            p:username="${jdbc.username}"
            p:password="${jdbc.password}" /&gt;
  
      &lt;!-- ADD PERSISTENCE SUPPORT HERE (jpa, hibernate, etc) --&gt;
      &lt;bean id="sessionFactory"
            class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"&gt;
            &lt;property name="dataSource" ref="dataSource"/&gt;
            &lt;property name="annotatedClasses"&gt;
                &lt;list&gt;
                    &lt;value&gt;training.springmvc.crud.model.Person&lt;/value&gt;
                &lt;/list&gt;
            &lt;/property&gt;
            &lt;property name="hibernateProperties"&gt;
                &lt;value&gt;hibernate.dialect=org.hibernate.dialect.MySQLDialect&lt;/value&gt;
            &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- Transaction Manager --&gt;
      &lt;bean id="txManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"&gt;
          &lt;property name="sessionFactory" ref="sessionFactory"/&gt;
      &lt;/bean&gt;
  
      &lt;!-- Service --&gt;
      &lt;bean id="personService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"&gt;
          &lt;property name="target"&gt;
              &lt;bean class="training.springmvc.crud.service.PersonServiceImpl"&gt;
                  &lt;property name="personDAO" ref="personDAO"/&gt;
              &lt;/bean&gt;
          &lt;/property&gt;
          &lt;property name="transactionAttributes"&gt;
              &lt;props&gt;
                  &lt;prop key="get*"&gt;PROPAGATION_SUPPORTS,readOnly&lt;/prop&gt;
                  &lt;prop key="*"&gt;PROPAGATION_REQUIRED&lt;/prop&gt;
              &lt;/props&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;!-- DAO --&gt;
      &lt;bean id="personDAO" class="training.springmvc.crud.dao.PersonDAOHib"
          p:sessionFactory="sessionFactory"
          p:sessionFactory-ref="sessionFactory"/&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>MyDao:</p>
  
  <pre><code>public class PersonDAOHib extends HibernateDaoSupport implements PersonDAO{
  
      public List getPersonList(){
          return getHibernateTemplate().find("from Person");
      }
  
      public Person getPerson(Long id){
          return (Person) getHibernateTemplate().get(Person.class, id);
      }
  
      public void savePerson(Person person){
          this.getHibernateTemplate().saveOrUpdate(person);
      }
  
      public void deletePerson(Long id){
          getHibernateTemplate().delete(getPerson(id));
      }
  }
  </code></pre>