Hibernate使用注解与Proxool连接池配置问题(一)

在Hibernate连接Proxool配置的连接池,并且mapping是class时

Error:

%%%% Error Creating SessionFactory %%%%
org.hibernate.MappingException: An AnnotationConfiguration instance is required to use <mapping class="com.bosure.gps.bean.Pos"/>
at org.hibernate.cfg.Configuration.parseMappingElement(Configuration.java:1634)
at org.hibernate.cfg.Configuration.parseSessionFactory(Configuration.java:1589)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1568)
at org.hibernate.cfg.Configuration.doConfigure(Configuration.java:1542)
at org.hibernate.cfg.Configuration.configure(Configuration.java:1462)
at com.bosure.factory.SessionFactory.<clinit>(SessionFactory.java:15)
at com.gps.test.Test.main(Test.java:10)

需要在:
HibernateSessionFactory中的Configuration要改成= new AnnotationConfiguration();
在导入hibernate-annotations.jar这个jar包

你可能感兴趣的:(java,Hibernate)