报错信息:org.hibernate.MappingException: Could not determine type for: java.long.Integer, at table: t_user, for columns: [org.hibernate.mapping.Column(age)]
解决方法:hibernate类型和java中的类型是不一样的,在hibernate的xml文件中设置的type指的是hibernate中的类型,而不能使用java.long.Integer
hibernate中的类型有string,integer, date,long, short, float, double, character, byte, boolean等等

错误:<property name="age" column="age" type="java.long.Integer" >
正确:<property name="age" column="age" type="integer" >
在使用Hibernate时遇到MappingException,错误提示为无法确定t_user表中age列的类型,原因是将java.lang.Integer误写为java.long.Integer。解决方法是确保在Hibernate的XML配置文件中,type属性应指定为hibernate内置的类型,如'integer',而非Java类型的全限定名。正确的配置应为:<property name='age' column='age' type='integer'/>, 这样可以避免类型匹配错误。
664

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



