当前位置: 代码迷 >> Java Web开发 >> hibernate+struts2
  详细解决方案

hibernate+struts2

热度:5977   发布时间:2013-02-25 21:15:31.0
在线等hibernate+struts2
错误信息:
%%%% Error Creating SessionFactory %%%%
org.hibernate.HibernateException: Unable to instantiate default tuplizer [org.hibernate.tuple.entity.PojoEntityTuplizer]
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:108)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructDefaultTuplizer(EntityTuplizerFactory.java:133)
at org.hibernate.tuple.entity.EntityEntityModeToTuplizerMapping.<init>(EntityEntityModeToTuplizerMapping.java:80)
at org.hibernate.tuple.entity.EntityMetamodel.<init>(EntityMetamodel.java:322)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:473)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:133)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:284)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1910)
at com.util.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:31)
at com.Test.main(Test.java:19)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at org.hibernate.tuple.entity.EntityTuplizerFactory.constructTuplizer(EntityTuplizerFactory.java:105)
... 10 more
Caused by: org.hibernate.PropertyNotFoundException: Could not find a getter for delFlg in class com.entity.User
at org.hibernate.property.BasicPropertyAccessor.createGetter(BasicPropertyAccessor.java:326)
at org.hibernate.property.BasicPropertyAccessor.getGetter(BasicPropertyAccessor.java:320)
at org.hibernate.mapping.Property.getGetter(Property.java:304)
at org.hibernate.tuple.entity.PojoEntityTuplizer.buildPropertyGetter(PojoEntityTuplizer.java:299)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.<init>(AbstractEntityTuplizer.java:155)
at org.hibernate.tuple.entity.PojoEntityTuplizer.<init>(PojoEntityTuplizer.java:77)
... 15 more
%%%% Error Creating SessionFactory %%%%
org.hibernate.InvalidMappingException: Could not parse mapping document from resource com/entity/User.hbm.xml
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:4006)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXmlQueue(Configuration.java:3995)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processMetadata(Configuration.java:3983)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1436)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1894)
at com.util.HibernateSessionFactory.rebuildSessionFactory(HibernateSessionFactory.java:70)
at com.util.HibernateSessionFactory.getSession(HibernateSessionFactory.java:53)
at com.Test.main(Test.java:19)
Caused by: org.hibernate.DuplicateMappingException: Duplicate class/entity mapping com.entity.User
at org.hibernate.cfg.Configuration$MappingsImpl.addClass(Configuration.java:3189)
at org.hibernate.cfg.HbmBinder.bindRoot(HbmBinder.java:176)
at org.hibernate.cfg.Configuration$MetadataSourceQueue.processHbmXml(Configuration.java:4003)
... 7 more
Exception in thread "main" java.lang.NullPointerException
at com.Test.main(Test.java:20)





hibernate.cfg.xml:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
  "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
  相关解决方案