Hibernate初学者配置常见错误

1、cound not found /hibernate.cfg.xml 找不到配置文件(是否在src下,是否配置文件名拼写错误)

2、不能解析文档:即文件能找到,但里面有错误 a) Could not parse configuration: /hibernate.cfg.xml b) Could not parse mapping document from resource cn/y2t99/test2/StudentBean.hbm.xml Error on line 13 of document  :错误发生的行数 The content of element type "class" is incomplete:class标记内容不完整,可能是没有结束标记,也可能是标记嵌套不正确,或者class标记内无内容

3、 could not interpret id generator strategy: assgined,说明主键生成策略错误,单词拼写错误

4、Could not find a getter for id in class com.jbit.user.bean.UserBean    UserBean有一个属性叫id,没提供getter/setter方法或者property标记的name中指定的属性名不存在

5、'hibernate.dialect' must be set when no Connection avalable     创建配置文件对象时没有调用configure方法    错误写法:Configuration config=new Configuration();    正确写法:Configuration config=new Configuration().cinfigure();

6、Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]    实体类应该实现序列化接口,不实现接口,可能正确,可能出问题;实现了接口,一定没问题

 

转载于:https://www.cnblogs.com/shisha/p/3249736.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值