-->
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: No Persistence provider for EntityManager named...
PostPosted: Thu Sep 15, 2005 2:14 pm 
Newbie

Joined: Thu Sep 15, 2005 2:09 pm
Posts: 2
I have used EJB 3.0 for about a month now in JBoss 4.0.3 RC's but I wanted to make just a small utility app for another purpose and decided to give Annotations, Entity Manager and Hibernate a shot in the J2SE. I recieve the following:

Code:
Sep 15, 2005 2:02:17 PM org.hibernate.cfg.Environment <clinit>
INFO: Hibernate 3.1 beta 3
Sep 15, 2005 2:02:17 PM org.hibernate.cfg.Environment <clinit>
INFO: hibernate.properties not found
Sep 15, 2005 2:02:17 PM org.hibernate.cfg.Environment <clinit>
INFO: using CGLIB reflection optimizer
Sep 15, 2005 2:02:17 PM org.hibernate.cfg.Environment <clinit>
INFO: using JDK 1.4 java.sql.Timestamp handling
IWAV0052E Invocation Target Exception creating com.cowgar.learning.hibernate.HelloHibernate
java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:585)
   at org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeansLauncher.main(JavaBeansLauncher.java:86)
Caused by: javax.persistence.PersistenceException: No Persistence provider for EntityManager named smarten
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:41)
   at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
   at com.cowgar.learning.hibernate.HelloHibernate.main(HelloHibernate.java:9)
   ... 5 more



My code is very simple:

Code:
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class HelloHibernate {
   public static void main(String[] args) {
      EntityManagerFactory emf = Persistence.createEntityManagerFactory("smarten");
      EntityManager em = emf.createEntityManager();
      
      Person p = new Person();
      p.setName("Jeremy");
      p.setPhone("555-1212");
      em.persist(p);
      
      em.close();
      emf.close();
   }
}


The persistence.xml:

Code:
<entity-manager>
   <name>smarten</name>
   <class>com.cowgar.learning.hibernate.Person</class>
   <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
       <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/>
       <property name="hibernate.connection.username" value="john"/>
       <property name="hibernate.connection.password" value="doe"/>
       <property name="hibernate.connection.url" value="jdbc:postgresql:smart"/>
       <property name="hibernate.max_fetch_depth" value="3"/>
       
       <!-- cache configuration -->
       <property name="hibernate.ejb.classcache.org.hibernate.ejb.test.Item" value="read-write"/>
       <property name="hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors" value="read-write, RegionName"/>

   </properties>
</entity-manager>


Any ideas as to what would cause this? I think I am following the manual on setting this up.

Thanks,

Jeremy


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 15, 2005 3:20 pm 
Newbie

Joined: Thu Sep 15, 2005 2:09 pm
Posts: 2
Figured it out. persistence.xml needs to go in the META-INF dir. Opps.

Jeremy


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.