-->
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.  [ 2 posts ] 
Author Message
 Post subject: Persistence unit not found
PostPosted: Wed Oct 10, 2007 1:07 am 
Beginner
Beginner

Joined: Mon May 07, 2007 11:12 pm
Posts: 20
Hello,

I am trying to get started with JPA. I have installed the Hibernate tools beta 11 and added the jars that go with the core and the annotations project. However, when I try to create the reverse-eng file, I get the error below.

Any thoughts on where the error could be?


Code:
org.hibernate.console.HibernateConsoleRuntimeException: Could not load JPA Configuration
Could not load JPA Configuration
  org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
  Could not create JPA based Configuration
    org.hibernate.console.HibernateConsoleRuntimeException: Could not create JPA based Configuration
    Could not create JPA based Configuration
    org.hibernate.console.HibernateConsoleRuntimeException: Persistence unit not found: 'null'.
    Persistence unit not found: 'null'.



Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 15, 2007 10:21 pm 
Newbie

Joined: Fri Oct 12, 2007 8:47 pm
Posts: 5
asegurate que el archivo de persistencia realmente exista y se encuente
en el directorio META-INF de tu aplicacion



Now it’s important to define a config file for your EntityManager. This file is named “persistence.xml” and has to be located in the “META-INF” directory (I think this is often a source of failure: Even in an exploded JAR-structure, the EntityManager factory looks for a “META-INF/persistence.xml”!)



In all cases, persistence.xml always resides in {root-of-persistence-unit}/META-INF/ directory. For example,


foo.war:
WEB-INF/classes/META-INF/persistence.xml //good
WEB-INF/classes/com/foo123/jpa/Project.class
WEB-INF/web.xml
index.jsp

You may also package entity classes and persistence.xml inside a library jar, which is packaged inside the war:
WEB-INF/lib
foo.war:
WEB-INF/lib/my-entities.jar
WEB-INF/web.xml
index.jspmy-entities.jar:
META-INF/persistence.xml //good
com/foo123/jpa/Project.class


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

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.