openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "icarus (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (OPENJPA-2483) Detached Entities and Lazy Loading behavior breaks portability
Date Thu, 13 Mar 2014 08:34:45 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-2483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13932997#comment-13932997
] 

icarus commented on OPENJPA-2483:
---------------------------------

Hello, thank you for your answer. 

Yes I'm aware that the chances are quit low. But like I said  it would already help if it
would be possible to configure each jpa implementation to behave the same. I'm also not sure
that all vendors are aware of the fact there there is not even the possibility to configure
a portable behavior. 

I tried the AccessUnloaded property it woks. Thanks for pointing that out. Now it is possible
to develop portable applications for OpenJPA and Hibernate or for EclipseLink and Hibernate.


> 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)

Mime
View raw message