icarus created OPENJPA-2483:
-------------------------------

             Summary: Detached Entities and Lazy Loading behavior breaks 
portability
                 Key: OPENJPA-2483
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2483
             Project: OpenJPA
          Issue Type: Bug
          Components: jpa
            Reporter: icarus
            Priority: Critical


Hello everyone!

I’ve created this bug in the EclipseLink, Hibernate and OpenJPA bugtracker 
because I think that the current situation is very unsatisfying for every 
developer that tries to develop portable Java EE applications.

I know the JPA specification says about this:
_“When interoperability across vendors is required, the application must not 
use lazy loading”_

But is the current situation really necessary? Let me summarize the behavior on 
accessing the relations of a detached entity among the different JPA vendors:

*OpenJPA:*
The getter methods returns always “null” in this case. No exception is thrown, 
and no access to the database.
I could not find a possibility to change this behavior.

*EclipseLink*
By default EclipseLink opens a new connection to the database and lazily 
fetches the relations.
I could not find a possibility to change this behavior.

*Hibernate*
By default Hibernate throws LazyInitializationException.
Since Version 4.1.6 there is a configuration parameter called 
“hibernate.enable_lazy_load_no_trans”.
If set to true hibernate opens a read only session to the database and lazily 
fetches the relations. (Same as eclipselink does)
This parameter is not mentioned in the official hibernate documentation. I 
found it by accident.

So 3 Vendors 3 different behaviors and no possibility to configure a behavior 
that is support on all providers.

I just want to say that I do not prefer a specific solution. All 3 solutions 
have their advantages and disadvantages. I do think however that this topic 
should be addressed by the JPA specification and that a there should be a 
mandatory behavior in the future.

But for now could you (the jpa vendors) speak to another and agree on a common 
denominator? For me as developer it would enough if I could configure this 
behavior on each jpa provider with a vendor specific property. Important is 
only that there is one solution that is supported by each provider.

Thanks for your time!




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to