Caused by: org.hibernate.MappingException: must specify an identifier type:

悠悠隱於市發表於2011-01-28

異常: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>

相關文章