问题有多种可能
首先hibernate包有没有导入,
然后hibernate.cfg.xml配置是否正确
Custmer的定义是否正确
只能一点点的找问题所在了

解决方案 »

  1.   

    hibernate.jar的包在CLASSPATH中设置了,hibernate.cfg.xml配置如下:---------------------<hibernate-configuration> <session-factory name="java:/hibernate/HibernateFactory">
    <property name="show_sql">true</property>
    <property name="connection.dirver_class">com.jnetdirect.jsql.JSQLDriver</property>
    <property name="connection.url">jdbc:JSQLConnect://user/database=hibernate</property>
    <property name="connection.username">sa</property>
    <property name="connection.password">sa</property>
    <property name="dialect"></property>
    <mapping resource="Customer.hbm.xml" />
    </session-factory>


    </hibernate-configuration>------------------------------------Customer.java 代码如下:------------------------------------public class Customer {
    private int id;
    private String username;
    private String password;

    public int getId(){
    return id;
    }

    public String getPassword(){
    return password;
    }

    public String getUsername(){
    return username;
    }

    public void setId(int id){
    this.id = id;
    }

    public void setPassword(String password){
    this.password = password;
    }

    public void setUsername(String username){
    this.username = username;
    }
    }