public class loginCheck extends ActionSupport {
String name;
String password;
public void setName(String name)
{
this.name=name;
}
public String getName()
{
return name;
}
public void setPassword(String password)
{
this.password=password;
}
public String getPassword()
{
return password;
}
public String execute() {
if(getName().equals(getPassword()))
{
Session session=HibernateSessionFactory.getSession();
Transaction ts=session.beginTransaction();
Table1Id t1=(Table1Id)session.get(Table1Id.class,1);
ts.commit();
System.out.print(t1.getName());
return SUCCESS;
}
else
return ERROR;
}
}
xml文件必须为 *.hbm.xml
置xml文件为嵌入的资源,用鼠标点击右键 然后生成操作里 选择嵌入的资源即可解决。