2
時當我試圖讓Hibernate的Session (Session session = HibernateUtil.getSession();)
我得到一個錯誤,如Hibernate錯誤:創建會話
Testcase: testMain(test.smssender.SmsSenderTest): Caused an ERROR
null
java.lang.ExceptionInInitializerError
at java.lang.reflect.Constructor.newInstance(Constructor.java:532)
at org.hibernate.engine.UnsavedValueFactory.instantiate(UnsavedValueFactory.java:22)
at org.hibernate.engine.UnsavedValueFactory.getUnsavedIdentifierValue(UnsavedValueFactory.java:44)
at org.hibernate.tuple.PropertyFactory.buildIdentifierProperty(PropertyFactory.java:44)
at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:123)
at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:434)
at org.hibernate.persister.entity.SingleTableEntityPersister.(SingleTableEntityPersister.java:109)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:226)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at vas.framework.hibernate.HibernateUtil.(HibernateUtil.java:38)
HibernateUtil.java文件的內容是在這裏:http://pastebin.com/exCCdX2P
我不能找出問題所在。任何幫助?
更新:重新創建實體對象解決了我的問題。
確保包含所需的jar文件進行休眠 – rags 2012-04-11 12:00:54
stacktrace表明無法實例化實體類。你的實體類構造函數可能會拋出一個異常,或者你可能沒有默認的構造函數嗎? – beny23 2012-04-11 12:08:32
發佈您嘗試保存的實體的代碼。 – ManuPK 2012-04-11 13:12:19