• Post Reply Bookmark Topic Watch Topic
  • New Topic

createEntityManagerFactory null  RSS feed

 
tarik el berrak
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have a problem with my jpa project.

here is the persistence file:
----------------------------------------------------------------------------
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0">
<persistence-unit name="QuotePickerPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.quotepicker.beans.QuoteBean</class>
<class>com.quotepicker.beans.CompanyBean</class>
<class>com.quotepicker.beans.QuoteBeanId</class>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver" />
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/trainning" />
<property name="hibernate.connection.username" value="root"/>
</properties>
</persistence-unit>
----------------------------------------------------------------------------

i get null when calling this

emf = Persistence.createEntityManagerFactory("QuotePickerPU");




any ideas ??

Thanks in advance

--------------------
 
Amandeep Singh
Ranch Hand
Posts: 853
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
emf = Persistence.createEntityManagerFactory("QuotePickerPU");

should always be called when outside the EJB container.

Can you let us know, are you calling it inside EJB container.
 
Chaminda Amarasinghe
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amandeep

How you say this

should always be called when outside the EJB container.


I went through the spec, But I couldn't find such restriction. That is true that we use this method for em creation outside container. But I think there is no restriction to use it in side the container
[ December 02, 2008: Message edited by: Chaminda Amarasinghe ]
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tarik,
Please let us know if your application is a stand alone application or deployed in a managed environment.
[ December 02, 2008: Message edited by: Amol Nayak ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
here is the persistence file

Where did you put persistence.xml ?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!