求助!!!运行java文件出现以下错误,哪位高人给看看这是怎么回事??万分感激!
------在加载Hibernate配置文件时抛出异常,内容如下:
org.hibernate.MappingException: Could not determine type for: java.lang.int, at table: tb_accession_form, for columns: [org.hibernate.mapping.Column(id)]
at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:269)
at org.hibernate.cfg.Configuration$1.getIdentifierType(Configuration.java:2111)
at org.hibernate.type.EntityType.getIdentifierType(EntityType.java:487)
at org.hibernate.type.EntityType.getIdentifierOrUniqueKeyType(EntityType.java:512)
at org.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:65)
at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:253)
at org.hibernate.mapping.ToOne.isValid(ToOne.java:82)
at org.hibernate.mapping.Property.isValid(Property.java:185)
at org.hibernate.mapping.PersistentClass.validate(PersistentClass.java:440)
at org.hibernate.mapping.RootClass.validate(RootClass.java:192)
at org.hibernate.cfg.Configuration.validate(Configuration.java:1108)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1293)
at com.mwq.hibernate.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:17)
at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:29)
at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
at com.mwq.frame.LandFrame.<init>(LandFrame.java:102)
at com.mwq.PersonnelManage.land(PersonnelManage.java:33)
at com.mwq.PersonnelManage$1.run(PersonnelManage.java:27)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.mwq.hibernate.HibernateSessionFactory.getSession(HibernateSessionFactory.java:27)
at com.mwq.hibernate.BaseDao.queryList(BaseDao.java:29)
at com.mwq.hibernate.Dao.queryManagerOfNatural(Dao.java:141)
at com.mwq.frame.LandFrame.<init>(LandFrame.java:102)
at com.mwq.PersonnelManage.land(PersonnelManage.java:33)
at com.mwq.PersonnelManage$1.run(PersonnelManage.java:27)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
开发工具eclipse 3.5.3+hibernate 3 原数据库是oracle 被我改成了sql2008 配置文件那不通了?
有一个问题不明白的是 hibernate配置文件中定义了一对多及多对一的关系,在sql中还用设置主键和外键吗?纠结中、、、
貌似没分了,哪位好心人帮帮我~ 万分感激!
[解决办法]
mapping 中的id类型,
应该是java.lang.integer
[解决办法]
你是不把类型配成java.lang.int了啊
你要配的话要不就写成int,要不写成java.lang.Integer.
基本类型是没有包的。