首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Exception >

请教关于hibernate 3.0 的初始化报错java.lang.ClassCastException:

2014-01-26 
Session sessionnew Configuration().configure().buildSessionFactory().openSession()

Session session=new Configuration().configure().buildSessionFactory().openSession();
  ============================
  Exception in thread "main" java.lang.ClassCastException: org.hibernate.type.StringType
  at org.hibernate.tuple.PropertyFactory.buildVersionProperty(PropertyFactory.java:81)
  at org.hibernate.tuple.EntityMetamodel.<init>(EntityMetamodel.java:147)
  at org.hibernate.persister.entity.BasicEntityPersister.<init>(BasicEntityPersister.java:400)
  at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:104)
  at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:55)
  at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:211)
  at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1005)
  at tmh.util.testsf.main(testsf.java:12)
 

------解决方法--------------------------------------------------------
你的类型映射有错误   

    
 

        

热点排行