cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Hibernate/JPA in our current Netweaver project

Former Member
0 Kudos

Hi together,

currently we are trying to migrate our Glassfish project to run under Netweaver. Til now, we have used Hibernate as the JPA Implementation.

If we are trying to deploy our EAR, we get the failure that the EntityManager (Persistance Unit) can not be created.

Here is our persistence-context.xml


	<persistence-unit name="soiPersistenceUnit" transaction-type="JTA">
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<jta-data-source>SOI_DB</jta-data-source>
		<class>de.hr.ec.hai.ejb.entity.Project</class>
                ...
		<properties>
			<property name="hibernate.dialect" value="org.hibernate.dialect.SAPDBDialect" />
			<property name="hibernate.hbm2ddl.auto" value="update" />
			<property name="hibernate.show_sql" value="true" />
 			<property name="hibernate.query.substitutions" value="true '1', false '0'" />
			<property name="hibernate.current_session_context_class" value="jta" />
			<property name="hibernate.transaction.manager_lookup_class" value="de.hr.ec.hai.ejb.service.SAPWebASTransactionManagerLookup" />
			<property name="hibernate.jdbc.batch.size" value="1" />
		</properties>
	</persistence-unit>

Has anyone an good hint to solve the problem?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks so far for your help.

It was my fault, the file is named persistence.xml already. Sorry.

Of course, one option is to switch to plain JPA, but this would mean to rewrite a lot of our application, because we are using Hibernate Specific queries.

We tried to migrate just one part of it, but than other strange things will happen.

For instance, in our WebApp we got null lists, for all objects, which have LAZY-fetched properties.

Anyway, we thought it is possible to still use Hibernate in our application, as we are providing the hibernate jars with our ear. If this is a bad idea, we would migrate to plain JPA.

Former Member
0 Kudos

Hi,

In SAP NetWeaver, you should use the persistence.xml file to configure the persistence unit.

More information: http://help.sap.com/saphelp_nwce711/helpdata/en/46/96ec3c33621e5ce10000000a1553f6/frameset.htm

Moreover, the properties you have are Hibernate-specific, which is perhaps one of the basic reasons for the problems you experience.

The SAP JPA platform supports all standard JPA properties (as per the EJB 3.0 specification) + the SAP-specific properties.

More information: http://help.sap.com/saphelp_nwce711/helpdata/en/77/fe0955fde340b3ab5220182d62b203/frameset.htm

Not least, you may need to consider the overall Java persistence infrastructure @ SAP.

More information: http://help.sap.com/saphelp_nwce711/helpdata/en/2d/23b32e8c0152469edf07909703fe03/frameset.htm

I hope that helps.

Best,

Yordan

P.S. I assume you want to migrate your application to SAP enhancement package 1 for SAP NetWeaver CE 7.1.

siarhei_pisarenka3
Active Contributor
0 Kudos

I'm not sure that Hibernate is contained in SAP Netweaver. Try to comment out the <provider> and its <properties> in the xml in order to use the default one:

	<persistence-unit name="soiPersistenceUnit" transaction-type="JTA">
		<jta-data-source>SOI_DB</jta-data-source>
		<class>de.hr.ec.hai.ejb.entity.Project</class>
                ...
	</persistence-unit>

Additionally, SAP IDE creates persistence.xml, not persistence-context.xml. Maybe this also has a special sense.

BR, Sergei