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>