我的映射文件中是这样写的:
<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)
------解决方法--------------------------------------------------------
最好用工具生成pojo的xml文件
------解决方法--------------------------------------------------------
把类型写成试一下!
type= "string "
------解决方法--------------------------------------------------------
把类型映射改为Hibernate的类型,,,还有最好是用工具生成,,如MyEclipse
------解决方法--------------------------------------------------------
是 addressip , 不是 operatorName 字段出错。
------解决方法--------------------------------------------------------
<property
name= "operatorName "
type= "java.lang.String "
column= "operator_name "
length= "10 "
>
</property>
type= "string "
------解决方法--------------------------------------------------------
type指的是hibernate中的类型,不是java中的String类型,必须小写,同样如integer也是要小写