I connected data base with hibernate to my application with this settings:
hibernateContext.xml
    <bean id="hibernateTemplate" class="org.springframework.orm.hibernate4.HibernateTemplate">
        <property name="sessionFactory" ref="sessionFactory" />
    </bean>
    <bean id="hibernateUserDao" class="org.springframework.web.basepackage.HibernateUserDao">
        <property name="hibernateTemplate" ref="hibernateTemplate" />
    </bean>  
this is hibernate.cfg.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
  <session-factory>
      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
      <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/fullproject</property>
      <property name="hibernate.connection.username">root</property>
      <property name="hibernate.connection.password">admin</property>
      <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
      <property name="hibernate.hbm2ddl.auto">update</property>
      <property name="hibernate.show_sql">true</property>
      <mapping resource="user.hbm.xml" />
  </session-factory>
</hibernate-configuration>
this is user.hbm.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="org.springframework.web.basepackage.User" table="users">
        <id name="id" column="id">
            <generator class="native" />
        </id>
        <property name="login" column="login"/>
        <property name="password" column="password" />
        <property name="email" column="email" />
    </class>
</hibernate-mapping>
this is my user entity
public class User {
    private int id;
    private String login;
    private String password;
    private String email;
    public User(){
    }
    public User(String login, String password, String email){
        this.login = login;
        this.password = password;
        this.email = email;
    }
    public int getId(){
        return id;
    }
    public String getLogin(){
        return login;
    }
    public String getPassword(){
        return password;
    }
    public String getEmail(){
        return email;
    }
    public void setId(int id){
        this.id = id;
    }
    public void setLogin(String login){
        this.login = login;
    }
    public void setPassword(String password){
        this.password = password;
    }
    public void setEmail(String email){
        this.email = email;
    }
}
when i try save db in this way "hibernateTemplate.save(user)' i catch in console this line "Hibernate: insert into users (login, password, email) values (?, ?, ?)" and changes don't save into database. I tried in user.hbn.xml change generator class to "increment" because my id in data base table has AUTO INCREMENT parameter, but it doesn't work.
 
     
    