org.hibernate.MappingException: Could not determine type for: java.lang.string
唉,糾結很久,看到一個帖子,很管用呀,問題解決了。貼上帖子原文:
我的對映檔案中是這樣寫的:
<property
name= "operatorName "
type= "java.lang.String "
column= "operator_name "
length= "10 "
>
</property>
資料庫是sybase的,對應資料型別為:varchar(10)。
啟動後出現上面的錯誤,請問是什麼原因?謝謝。
org.hibernate.MappingException: Could not determine type for: java.lang.string, for columns: [org.hibernate.mapping.Column(addressip)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:266)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.Property.isValid(Property.java:184)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:370)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:983)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1147)
解決辦法:
這才說的對 把java.lang.String 換成 string 就對了