sabine.heider

Previous post Next post
Currently Being Moderated

With JPA as
the standard for object-relational persistence, you are in the comfortable
position of being able to choose your favorite implementation from a set of
well-established persistence providers. While every Java EE application server
is delivered with a JPA provider that is used per default, the Java EE standard
allows for exchanging the persistence provider on a per-application basis (or to
be precise: on a per-persistence unit basis). There might be good reason to
decide for another JPA implementation - be it that you would like to leverage a
certain feature of a particular provider, be it that you experience better
performance measures with that provider, or that you are simply more familiar
with it.



EclipseLink
is one of the most popular open source JPA providers. In this blog, I'll guide
you step by step through the procedure how to use EclipseLink as a JPA provider
in SAP NetWeaver AS Java. I will also point you the limitations you have to be
aware of when using Eclipse Link in the NetWeaver server.

 

Required Versions

 

 

EclipseLink Version

 

 

EclipseLink
has to be aware of the specific application server environment in which it is
used. For that purpose, EclipseLink has separate ServerPlatform implementation
classes for the different application servers in the market. Starting with
EclipseLink 2.1.0, the adapter class for SAP NetWeaver AS Java is contained in
the standard EclipseLink delivery. We refer to this class as the NetWeaver
server platform.

 

SAP NetWeaver AS Java
Version

 

 

The
NetWeaver server platform is supposed to work with SAP NetWeaver 7.1 EHP 1 and
higher, although, at present, EclipseLink's server test suite has only been
executed on version 7.2 and higher.

 

Procedure

 

 

In the
following, I'll guide you step by step through the procedure how to use
EclipseLink as a JPA provider in SAP NetWeaver AS Java:

 

Download EclipseLink

 

 

 

You can download EclipseLink from this location: http://www.eclipse.org/eclipselink/downloads/index.php



Make sure to
get EclipseLink version 2.1.0 or higher in order that the archive contains the
NetWeaver server platform class.

 

Package and Deploy
EclipseLink

 

 

As a next
step, you should package the eclipselink.jar file from the download in a way
that it can be deployed to the SAP NetWeaver AS Java server. We recommend that
you deploy it as a so called "shared library", so that you have it centrally
available and can use it from multiple applications.



Follow the
instructions given in the SAP Help Portal to package EclipseLink as a shared
library and deploy it to your application server:



For SAP NetWeaver 7.2: Using Shared Libraries (7.2) , section „Creating Shared Libraries"

For SAP NetWeaver 7.1 EHP 1: Using Shared Libraries (7.1 EHP1) , section „Creating Shared Libraries"</li></ul>

 

Add an Application
Reference

 

 

For SAP NetWeaver 7.2: Using Shared Libraries (7.2) , section „Referencing Shared Libraries"

For SAP NetWeaver 7.1 EHP 1: Using Shared Libraries (7.1 EHP1) , section „Referencing Shared Libraries"</li></ul>

 

 

 

Configure EclipseLink as JPA
Provider for Your Application

 

 

 

 

 

 

Limitations

 

 

Use JPA 1.0 Only

 

 

SAP
NetWeaver AS Java is a Java EE 5 application server and, as such, supports JPA
1.0 only. EclipseLink version 2.1.0 or higher, on the other hand, is a JPA 2.0
compliant JPA provider. However, due to the fact that JPA 2.0 is backward
compatible to JPA 1.0, it can act as a JPA 1.0 provider as well.



We strongly
recommend that you limit your application to the JPA 1.0 features. While you
might succeed to a certain degree even with leveraging selected JPA 2.0
features, you will most likely face some fundamental conceptual problems.

 

Use Static Weaving Instead
of Dynamic Weaving

 

 

EclipseLink
uses a byte-code manipulation technique called "weaving" for optimizing the
handling of JPA entities (including lazy loading of relations and attributes,
change detection and other performance optimizations). EclipseLink can perform
byte-code weaving either dynamically at runtime when the entity classes are
loaded, or statically at compile time of the application.



 

However, dynamic weaving can't be used inside SAP NetWeaver AS Java, so you should use static weaving instead. See http://wiki.eclipse.org/Using_EclipseLink_JPA_Extensions_%28ELUG%29#Using_EclipseLink_JPA_Weaving for more information on EclipseLink's weaving .</p>

 

Use Native SQL Instead of Open
SQL

 

 

EclipseLink
is not aware of SAP NetWeaver AS Java's database abstraction framework known as
Open SQL and therefore generates SQL statements that are not compliant to the
Open SQL syntax. With EclipseLink you should therefore use a data source that
is defined with Native SQL (or Vendor SQL) as SQL engine type. In particular, that
means you can't use the applications server's system data source but have to
create a custom one. Refer to the SAP help portal for a description of how to work with data sources in SAP NetWeaver:


 

EclipseLink Is Not Covered
by SAP Support Agreements

 

 

You have to
be aware that EclipseLink is currently not covered by any support agreements
you have with SAP. Unless you have made special agreements, you are limited to
the regular support that you get in an open source community.

 

Get Involved!

 

 

Your
feedback on using EclipseLink within the NetWeaver server is very much
appreciated. We are interested in any issues you might have with the
integration but also in your ideas or suggestions for future enhancements. What
exactly is it that you need or that annoys you currently?



 

In most cases, the appropriate channel for reporting problems with EclipseLink is the Eclipse bug database Bugzilla . If you need further advice on using or configuring EclipseLink, you can also consult the eclipselink-users
mailing list
.

 

Further Links

 

 

EclipseLink project: http://www.eclipse.org/eclipselink/
EclipseLink user guide: http://wiki.eclipse.org/EclipseLink/UserGuide
EclipseLink download site: http://www.eclipse.org/eclipselink/downloads/index.php
NetWeaver server platform: http://wiki.eclipse.org/EclipseLink/Development/ServerPlatform/NetweaverPlatform
Bugzilla: https://bugs.eclipse.org/bugs/
eclipselink-users mailing list: https://dev.eclipse.org/mailman/listinfo/eclipselink-users </li></ul>

Comments