-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: JSE Application with JPA 2.1
PostPosted: Fri Mar 28, 2014 5:16 am 
Beginner
Beginner

Joined: Sat Feb 16, 2008 3:09 pm
Posts: 24
Hello,

I am trying to build an JSE application with JPA using hibernate and maven.

pom dependencies.
Code:
<dependencies>
      <dependency>
         <groupId>junit</groupId>
         <artifactId>junit</artifactId>
         <version>3.8.1</version>
         <scope>test</scope>
      </dependency>
      <dependency>
         <groupId>com.oracle</groupId>
         <artifactId>ojdbc6</artifactId>
         <version>11.1.0.7.0</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate.javax.persistence</groupId>
         <artifactId>hibernate-jpa-2.1-api</artifactId>
         <version>1.0.0.Final</version>
      </dependency>
      <dependency>
         <groupId>org.hibernate</groupId>
         <artifactId>hibernate-entitymanager</artifactId>
         <version>4.0.1.Final</version>
      </dependency>
   </dependencies>


persistence.xml in /src/main/resources/META-INF:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
             xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
   <persistence-unit name="bla" transaction-type="RESOURCE_LOCAL">
      <properties>
         <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.OracleDriver" />
         <property name="javax.persistence.jdbc.url"
            value="jdbc:oracle:thin:@localhost:1521:XE" />
         <property name="javax.persistence.jdbc.user" value="bla" />
         <property name="javax.persistence.jdbc.password" value="bla" />
      </properties>
   </persistence-unit>
</persistence>


With that I get
Code:
Mrz 28, 2014 10:02:00 AM org.hibernate.annotations.common.Version <clinit>
INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}
Mrz 28, 2014 10:02:00 AM org.hibernate.Version logVersion
INFO: HHH000412: Hibernate Core {4.0.1.Final}
Mrz 28, 2014 10:02:00 AM org.hibernate.cfg.Environment <clinit>
INFO: HHH000206: hibernate.properties not found
Mrz 28, 2014 10:02:00 AM org.hibernate.cfg.Environment buildBytecodeProvider
INFO: HHH000021: Bytecode provider name : javassist
Exception in thread "main" javax.persistence.PersistenceException: Invalid persistence.xml.
Error parsing XML (line-1 : column -1): cvc-elt.1: Deklaration des Elements "persistence" kann nicht gefunden werden.

   at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:145)
   at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:169)
   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:323)
   at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:55)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
   at de.bwl.uis.module.wasserrecht.App.main(App.java:19)


Declaration of element "persistence" cannot be found

Is there by any chance a maven archetype that can be used for this kind of project?

Any help would be greatly appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.