-->
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.  [ 7 posts ] 
Author Message
 Post subject: Issue with Persistence.createEntityManager
PostPosted: Mon Jan 23, 2006 1:22 pm 
Newbie

Joined: Mon Jan 23, 2006 1:11 pm
Posts: 15
Location: Leuven, Belgium
Hello, i'm using the latest (released) versions of hibernate, annotations and entitymanager.

The following code results in an error:

Code:
<%@ page import="javax.persistence.*" %>
<%
EntityManagerFactory emf = Persistence.createEntityManagerFactory("regapan");
%>


Quote:
java.lang.NullPointerException
at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:68)
at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:139)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:103)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:27)
at _jsp._test__jsp._jspService(test.jsp:3)
at com.caucho.jsp.JavaPage.service(JavaPage.java:60)
......



The following code doesn't result in an error:

Code:
<%@ page import="java.util.*, javax.persistence.*" %>
<%
Map cfg = new HashMap();
EntityManagerFactory emf = Persistence.createEntityManagerFactory("regapan", cfg);
%>


I've looked in the source, and i don't really understand why there is a call to log.fatal in org.hibernate.ejb.packaging.PersistenceXmlLoader.java line 101.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 5:56 pm 
Newbie

Joined: Mon Jan 23, 2006 5:53 pm
Posts: 1
I tried this, and it worked

Persistence.createEntityManagerFactory(persistenceUnitName,new HashMap())


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 23, 2006 7:49 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Damn, a hole in my test suite. This is fixed in CVS thanks.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 12:25 pm 
Newbie

Joined: Wed Jun 15, 2005 9:18 am
Posts: 11
Hello,

According to the cvs, the deploy method of PersistenceXmlLoader still throws a nullPointerException if the overrides parameter is null.

Code:
public static List<PersistenceMetadata> deploy(URL url, Map overrides) throws Exception {
...
String provider = (String) overrides.get( HibernatePersistence.PROVIDER );
...
}


Is it a deliberate choice ?

Thanks,

Gengis,


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 07, 2006 12:32 pm 
Newbie

Joined: Fri Feb 03, 2006 3:42 pm
Posts: 4
Location: Manassas, VA USA
Emmanual, I had submitted EJB-124 in JIRA for this on Feb 3. Should I have put on user forum in addition/instead?

_________________
Bill Squires


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 2:32 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Gengis wrote:
Hello,

According to the cvs, the deploy method of PersistenceXmlLoader still throws a nullPointerException if the overrides parameter is null.

Code:
public static List<PersistenceMetadata> deploy(URL url, Map overrides) throws Exception {
...
String provider = (String) overrides.get( HibernatePersistence.PROVIDER );
...
}


HEM has more than a single class. This is fixed in CVS with a unit test

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Feb 08, 2006 2:33 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
jagula wrote:
Emmanual, I had submitted EJB-124 in JIRA for this on Feb 3. Should I have put on user forum in addition/instead?


this is a dupe of EJB-114, I was wayyyyy faster than you ;-)

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.