JPA问题,报空指针异常
EntityManagerFactoryfactory=Persistence.createEntityManagerFactory("jpaTest");在执行这句话的...
EntityManagerFactory factory = Persistence.createEntityManagerFactory("jpaTest");
在执行这句话的时候报空指针异常,搞了一天也没搞明白是怎么回事。
persistence.xml文件如下
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="jpaTest" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:XE" />
<property name="hibernate.connection.username" value="jpa" />
<property name="hibernate.connection.password" value="jpa" />
</properties>
</persistence-unit>
</persistence>
请明白的给小弟解释下,这是怎么回事。 展开
在执行这句话的时候报空指针异常,搞了一天也没搞明白是怎么回事。
persistence.xml文件如下
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<persistence-unit name="jpaTest" transaction-type="RESOURCE_LOCAL">
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver" />
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost:1521:XE" />
<property name="hibernate.connection.username" value="jpa" />
<property name="hibernate.connection.password" value="jpa" />
</properties>
</persistence-unit>
</persistence>
请明白的给小弟解释下,这是怎么回事。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询