Hibernate使用问题
用Hibernate4.1.2来完成一个简单的查询
hibernate.cfg.xml的文档类型说明如下
XML code
xmlns="http://www.hibernate.org/xsd/hibernate-configuration"
xsi:schemaLocation="http://www.hibernate.org/xsd/hibernate-configuration hibernate-configuration-4.0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
是不是因为这个,所以出现了底下的错误呢?
2012-4-27 11:29:30 org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
2012-4-27 11:29:30 org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.1.2.Final}
Exception in thread "main"
java.lang.ExceptionInInitializerError at org.hibernate.cfg.Configuration.reset(Configuration.java:299)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:265)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:269)
at DAO.gradeManager.main(gradeManager.java:14)
Caused by: java.lang.NullPointerException at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
... 4 more
------解决方案--------------------java.lang.NullPointerException 空指针楼主的配置文件以及查询的Dao贴出来看看
------解决方案--------------------貌似和你用的注解有点关系吧……上面按个schema只是起一个约束作用,不会影响的……