cancel
Showing results for 
Search instead for 
Did you mean: 

No Persistence provider for EntityManager named PROJECT_EM

Former Member
0 Kudos

Hello,

we want to use JPA and get the Excepeption PersistenceException saying No Persistence provider for EntityManager named PROJECT_EM at the call of:


EntityManagerFactory emf = Persistence.createEntityManagerFactory("PROJECT_EM");

Our persistence.xml looks like:


<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
	<persistence-unit name="PROJECT_EM">
		<jta-data-source>PROJECT_DB</jta-data-source>
		<mapping-file>META-INF/orm.xml</mapping-file>
                <class>com.sap.coe.project.db.bean.ProjectDevPhysId</class>
		<class>com.sap.coe.project.db.bean.ProjectMessCounter</class>
                <class>com.sap.coe.project.db.bean.ProjectMessAdmin</class>
		<class>com.sap.coe.project.db.bean.ProjectInMessages</class>
		<class>com.sap.coe.project.db.bean.ProjectOutMessages</class>
		<class>com.sap.coe.project.db.bean.ProjectPackage</class>
	</persistence-unit>
</persistence>

Thanx for any help

Best regards,

Frank

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

I had some progress, I added the following in the persistence.xml



<persistence-unit name="Learning_JPA_Entity01">
	<provider>com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl</provider>	
		<mapping-file>META-INF/orm.xml</mapping-file> 
		<class>com.sap.sii.archeiver.SII_MA_DeviceInfo</class>

and now the exception changes to the following..


Exception in thread "main" java.lang.IllegalArgumentException: The value >>null<< is no valid temporal type.
	at com.sap.engine.services.orpersistence.model.ormappingmodel.impl.ORMUtils.parseTemporalType(ORMUtils.java:1172)
	at com.sap.engine.services.orpersistence.model.ormappingmodel.impl.ORMappingModelCreatorImpl.parseBasic(ORMappingModelCreatorImpl.java:3654)
	at com.sap.engine.services.orpersistence.model.ormappingmodel.impl.ORMappingModelCreatorImpl.parseSingleFields(ORMappingModelCreatorImpl.java:3233)
	at com.sap.engine.services.orpersistence.model.ormappingmodel.impl.ORMappingModelCreatorImpl.parsePersistentClass(ORMappingModelCreatorImpl.java:1045)
	at com.sap.engine.services.orpersistence.model.ormappingmodel.impl.ORMappingModelCreatorImpl.createModel(ORMappingModelCreatorImpl.java:366)
	at com.sap.engine.services.orpersistence.model.ormappingmodel.impl.ORMappingModelCreatorImpl.createModel(ORMappingModelCreatorImpl.java:306)
	at com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl.createEntityManagerFactory0(PersistenceProviderImpl.java:294)
	at com.sap.engine.services.orpersistence.provider.PersistenceProviderImpl.createEntityManagerFactory(PersistenceProviderImpl.java:109)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
	at com.sap.sii.archeiver.DeviceInfoWrapper.initEM(DeviceInfoWrapper.java:24)
	at com.sap.sii.testing.archeiver.Main.doCreateEvent(Main.java:11)

anyone understands where this "NULL" comes from !!

Former Member
0 Kudos

does anyone solved this problem..?

I am working on something similar. It is a stand alone JPA application, I have the same stuff in the persistence.xml and my code looks like


	@PersistenceUnit
	private EntityManagerFactory emf;

	public void initEM(){
		emf = Persistence.createEntityManagerFactory("Learning_JPA_Entity01");
		em = emf.createEntityManager();
	}

still I get this error.


No Persistence provider for EntityManager named Learning_JPA_Entity01

any one had this error...?

cheers

domnic

Former Member
0 Kudos

Hi!

Do you use JPA in a standalone or server environment? In the latter case I would recommend you to use EJB's dependency injection in order to get an EntityManager. In standalone use case you can refer to the JPA standalone documentation and examples that are shipped with NetWeaver CE. You can find them in

/usr/sap/<SID>/<JCxx>/j2ee/jpa

.

Best Regards,

Robin

Former Member
0 Kudos

Hello,

thank you, I found the examples. We are not in a managed environment and therefore can't use injection. Unfortunately in the example they provided only class Files... So it does not really help us.

I tried to put the connection properties in the persistence.xml but result is the same. I anyway expected it to use the given datasource, as I really don't want to use those parameters in a file in the application.

I will continue without using JPA but old style JDBC for now.

Frank

adrian_goerler
Active Participant
0 Kudos

Hi Frank,

the sources of the samples are included in the archive orpersistence_example.jar.

Best regards,

Adrian

Edited by: Adrian Goerler on Feb 25, 2008 4:48 PM