Caused by: org.hibernate.MappingException: must specify an identifier type
异常:Caused by: org.hibernate.MappingException: must specify an identifier type:
view plaincopy to clipboardprint?
Caused by: org.hibernate.MappingException: must specify an identifier type: com.xycentre.otms.usermanager.model.OtmsUser
at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:418)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:356)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)
Caused by: org.hibernate.MappingException: must specify an identifier type: com.xycentre.otms.usermanager.model.User
at org.hibernate.cfg.HbmBinder.bindSimpleId(HbmBinder.java:418)
at org.hibernate.cfg.HbmBinder.bindRootPersistentClassCommonValues(HbmBinder.java:356)
at org.hibernate.cfg.HbmBinder.bindRootClass(HbmBinder.java:295)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:166)
解决方案:
User.hbm.xml里id的name没有写..
把ID里面的name属性写上,就没事.
<id name="userID" column="USER_ID" type="java.lang.String"> <generator class="native"></generator> </id>
本文介绍了在使用Hibernate框架时遇到的MappingException异常,该异常提示必须指定标识符类型。问题出现在User.hbm.xml文件中ID元素缺少name属性。通过添加name属性解决了此问题。
1万+

被折叠的 条评论
为什么被折叠?



