cancel
Showing results for 
Search instead for 
Did you mean: 

JPA: Documentation on LazyLoad

Former Member
0 Kudos

Hi,

is there any documentation how lazy load is implemented in the SAP JPA, especially for 1-1 associations?

EclipseLink has severall options (ValueHolder, Proxy) how to handle them, each of them has IMHO a drawback. So how is it done with SAP JPA?

Kind regars

Jan

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Jan,

There is no such documentation.

I guess that some of the colleagues from development are reading the forums and could provide some details on the implementation.

Best,

Yordan

Former Member
0 Kudos

Good question - good return.. No answer?

I would love to see some documentation about this issue.. and many others about the SAP JPA implementation...

Btw: I guess there is no "public" documentation available covering SAP JPA implementation details. Too bad.. I think we better use hibernate or any other well documented JPA implementation.

Thx

-DD

Edited by: dolly_olesia on Apr 14, 2010 10:15 PM

rolf_paulsen
Active Participant
0 Kudos

Hi Dolly,

your guess is right. Despite good contacts to SAP, we could not get any line nor any info about SAP JPA implementation out of SAP developers for 3 months last year. The "support" for SAP JPA in SDN fits in. It is not understandable since the JPA-implementation is a crucial part of a nontrivial JEE-Application.

In the meanwhile, we gave up. Since SAP NetWeaver IS a JEE compliant Appserver, go with one of the other well documented JPA implementations (not only hibernate, also "the other one" =EL works great).

Let me go one step back from the initial question:

Lazy Loading of @ManyToOne and @OneToOne-Relations does not work via Reflection, but requires ByteCode-Manipulation (Weaving).

1. Does SAP JPA provide Lazy Loading for @ManyToOne and @OneToOne-Relations at all?

2. If 1. yes: please answer the initial question

3. If 1. yes: Does it implement the javax.persistence.spi.PersistenceUnitInfo.addTransformer interface?

4. If 1. yes: Is it possible to use Lazy xToOne-Bytecode-Weaving with SAP JPA orpersistence.jar in standalone mode?

5. Does the SAP Netweaver EJB Container support ClassTransformers for Persistence-Providers (according to JSR 220 JPA 1.0 spec)?

Thanx and Regards

Rolf

adrian_goerler
Active Participant
0 Kudos

Hi Jan, Rolf,

lazy loading of single-valued relationships is indeed a pain-point in SAP JPA. The situation is as follows:

Up to version 7.2 SAP JPA does not support lazy loading of single-valued relationships. This means single-valued relationships are always loaded eagerly. This can lead to excessively large relationship graphs being loaded, in bad situations. If you need to break a relationship graph, you either have got to artificially introduce a collection-valued relationship or you do without that relationship at all and load the related entity "manually".

Lazy loading of single-valued relationships will be supported with the follow-up release of 7.2 ("7.30";). However, it will not use byte-code enhancement but proxy generation. (A proxy subclass will be generated for lazily loaded entities, which fetches the attributes upon access of any method of the proxy class). Unfortunately, proxy generation will not be available for entities, which are part of an entity hierarchy.

Actually, this technique was "already" available in 7.2 but the required byte-code generation library (cglib) was not part of the product, so it could not be released. The next release "7.30"; will contain the cglib and the feature will be there. If you truely miss the feature, please file a ticket in OSS under BC-JAS-PER-JPA.

Comming to the next pain-point: No, the JPA container of SAP NetWeaver AS Java does not support class transformers. This means that in order to leverage bytecode-enhancement of third-party persistence-providers you have to use static weaving. I do consider this a bug. Please feel free to file a ticket in OSS under BC-JAS-PER-JPA with respect to this issue.

Finally, please allow me a general comment on using third-party persistence-providers in NetWeaver AS Java:

In Java EE, the persistence provider is plugable. NetWeaver AS Java comes with SAP JPA as the default persistence provider. However, we are well aware of the fact that there are alternative, excellent, popular, well-documented persistence providers available. Namely Hibernate, EclipseLink and Open JPA have successfully been tested with NetWeaver AS Java. All persistence providers have their individual strengths and weaknesses. Everybody is encouraged to freely choose the persistence provider that best fits his needs.

SAP JPA is unique in some respects: it is a direct and legacy-free implementation of the JPA 1.0 specification. It works smoothely with Open SQL and the Java Dictionary. It is well integrated with the NetWeaver Administrator and the NWDS. On the other hand, the implementation is quite minimalistic, feature-wise.

Unfortunately, given the availability and popularity of strong third-party presistence providers, SAP has limited the investement in SAP JPA. If you can do without Open SQL and Java Dictionary, you might indeed be good advised to look into using a third-party persistence provider.

-Adrian

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Adrian,

a lot of thanks for the very detailed information and insights.

As persistence is a very critical issue in every new JEE application, I think it would be appropriate that

1.) SAP provides more detailed documentation about SAP-JPA

2.) SAP provides informationen how to integrate third party persistence provider.

Kind regards

Jan