hibernate一对多关联映射,数据库的表有,但是添加数据失败,控制台打印Cleaning up connection pool

hibernate一对多关联映射,数据库的表有,但是添加数据失败,控制台打印Cleaning up connection pool !。再进行dubg调试的时候发现,根本不能获取session对象,导致“Cleaning up connection pool”

网上说:*.hmb.xml文件中的属性名和pojo不一致,字段属性没有正确配置.

但是我查看了*.hmb.xml文件的所有的字段都可以链接到对应类文件里面。

查看JUnit,发现报“Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister”错误,和

“PropertyNotFoundException: Could not locate getter method for property [com.coco.hibernate.Classes1#students]”错误,再次查看对应的Classes1对应类文件里面get和set方法,发现getStudent()方法后面少一个S,因为这个数据后面我有手动更改过,所以导致报错。将students相关的get和set方法删除,重新生成就可以了

public Set get Student() {
        return students;
    }





猜你喜欢

转载自blog.csdn.net/u012918886/article/details/80630304