解决方案 »

  1.   

    用这种方式拿试试看,碰到问题先google下,或许就有解决办法了。
    Configuration cfg = new AnnoationConfiguration();
    SessionFactory sf = cfg.configure().buildSessionFactory();
      

  2.   

    你的pojo 没配置好
    实体类-----------@Entity/@Table----------数据表
    Id--------------@Id----------主键
    普通属性---------@Column----------普通键
    集合属性---------@OneToMany/@ManyToOne/@ManyToMany/@OneToOne/@OneToMany----------外键
      

  3.   

    @Entity
    @Table(name = "STUDENT")
    public class Student {
    private int id ;
    private String name ;
    private int age ;
    @Id
    public int getId() {
    return id;
    }
    public void setId(int id) {
    this.id = id;
    }
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }
    public int getAge() {
    return age;
    }
    public void setAge(int age) {
    this.age = age;
    }}
      

  4.   

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid.hex")
    @Column(name = "ID", unique = true, nullable = false)