运行第一章的例子时测试报错,控制台显示如下错误,跪求解答

来源:1-7 hibernate配置文档

幕粉一枚

2018-02-23 10:21

二月 23, 2018 10:13:13 上午 org.hibernate.cfg.Configuration doConfigure

INFO: HHH000041: Configured SessionFactory: null

二月 23, 2018 10:13:13 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)

二月 23, 2018 10:13:13 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000115: Hibernate connection pool size: 20

二月 23, 2018 10:13:13 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000006: Autocommit mode: false

二月 23, 2018 10:13:13 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql:///practice?useUnicode=true&characterEncoding=UTF-8]

二月 23, 2018 10:13:13 上午 org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000046: Connection properties: {user=root, password=****}

二月 23, 2018 10:13:13 上午 org.hibernate.dialect.Dialect <init>

INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect

二月 23, 2018 10:13:13 上午 org.hibernate.engine.jdbc.internal.LobCreatorBuilder useContextualLobCreation

INFO: HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4


写回答 关注

2回答

  • 幕粉一枚
    2018-03-01 18:35:12

    public class Students {

       private int sid;

       private String sname;

       private String gender;

       private Date birthday;

       private String address;

       

       public Students(){}


       public Students(int sid, String sname, String gender, Date birthday, String address) {

    //super();

    this.sid = sid;

    this.sname = sname;

    this.gender = gender;

    this.birthday = birthday;

    this.address = address;

       }


       public int getSid() {

    return sid;

       }


       public void setSid(int sid) {

    this.sid = sid;

       }


       public String getSname() {

    return sname;

       }


       public void setSname(String sname) {

    this.sname = sname;

       }


       public String getGender() {

    return gender;

       }


       public void setGender(String gender) {

    this.gender = gender;

       }


       public Date getBirthday() {

    return birthday;

       }


       public void setBirthday(Date birthday) {

    this.birthday = birthday;

       }


       public String getAddress() {

    return address;

       }


       public void setAddress(String address) {

    this.address = address;

       }


    @Override

    public String toString() {

    return "Students [sid=" + sid + ", sname=" + sname + ", gender=" + gender + ", birthday=" + birthday + ", address="

    + address + "]";

    }

       

       

    }


  • 慕圣1552571
    2018-02-23 16:34:03

    检查下 bean类是否匹配 hbm.xml 文件

    1、属性是否匹配

    2、属性值否匹配

    最好把配置文件贴出来看看

Hibernate初探之单表映射

Java持久化框架Hibernate入门教程,掌握Hibernate基本概念

74810 学习 · 793 问题

查看课程

相似问题