Error Unknown column 'pass' in 'field list'
Clase Alumno:
package Servicios;
public class Usuario implements Serializable{
private String mail;
private String pass;
private String nick;
public Usuario(String mail,String pass){
this.mail=mail;
this.pass=pass;
}
public Usuario(String mail,String pass,String nick){
this.mail=mail;
this.pass=pass;
this.nick=nick;
}
public String getMail() {
return mail;
}
public void setMail(String mail) {
this.mail = mail;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getNick() {
return nick;
}
public void setNick(String nick) {
this.nick = nick;
}
}
Usuario.hbn.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
<class name="Servicios.Usuario" table="Usuario" >
<id column="mail" name="mail" />
<property name="pass" column="pass"/>
<property name="nick" column="nick" />
</class>
</hibernate-mapping>
Metodo main:
package Servicios;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import org.hibernate.service.ServiceRegistryBuilder;
public class Main {
public static void main(String[] args) {
SessionFactory sessionFactory;
Configuration configuration = new Configuration().configure();
ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
Usuario user=new Usuario("[email protected]","1234");
Session session = sessionFactory.openSession();
session.beginTransaction();
session.save(user);
session.getTransaction().commit();
session.close();
}
}