JPA 프로젝트로 최대 절전 모드를 개발 중이고 H2 (Embedded Database)를 사용하여 작업 persistence.xml을 얻으려고합니다. persistence.xml을H2 데이터베이스와 JPA 연결
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
version="1.0">
<persistence-unit name="DefaultPersistenceUnit"
transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>entity.user</class>
<properties>
<property name="hibernate.connection.url" value="jdbc:h2:/~test" /> -->
<property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"></property>
<property name="hibernate.connection.driver_class" value="org.h2.Driver" />
<property name="hibernate.connection.password" value="admin" />
<property name="hibernate.connection.username" value="admin" />
</properties>
</persistence-unit>
</persistence>
하지만 내이 작동하지 않는 경우, 항상 내가
"의 EntityManagerFactory를 만들 수 없습니다"라는 오류
EntityManagerFactory emf = Persistence.createEntityManagerFactory("DefaultPersistenceUnit");
을 얻고있다. 아무리 나에게 persistence.xml 파일을 제공 할 수 있습니까?
오류 메시지에 대해서만 언급합니까? 더 자세한 메시지 및/또는 스택 추적을 가지고 계시지 않습니까? 당신의 클래스는 정말로 entity.user라는 이름입니까? –
'hibernate.connection.url'은 실제로'jdbc : h2 :/~ test'입니까? 'jdbc : h2 : file : ~/test; IFEXISTS = TRUE'가 더 그럴듯 해 보입니다. – trashgod
[Hibernate의 버전] (http://www.h2database.com/html/tutorial.html#using_hibernate)은 무엇입니까? – trashgod