You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@olingo.apache.org by "Chandan V.A (JIRA)" <ji...@apache.org> on 2015/03/26 10:11:52 UTC
[jira] [Resolved] (OLINGO-604) Injected Entity Managers are closed
after fetching query results
[ https://issues.apache.org/jira/browse/OLINGO-604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Chandan V.A resolved OLINGO-604.
--------------------------------
Resolution: Fixed
> Injected Entity Managers are closed after fetching query results
> ----------------------------------------------------------------
>
> Key: OLINGO-604
> URL: https://issues.apache.org/jira/browse/OLINGO-604
> Project: Olingo
> Issue Type: Bug
> Components: odata2-jpa
> Affects Versions: V2 2.0.4
> Reporter: Chandan V.A
> Assignee: Chandan V.A
> Priority: Minor
>
> There is an issue with the way the result list is accessed in JPAProcessor method: private Object readEntity(final Object uriParserResultView, final JPQLContextType contextType)
> Currently (Olingo 2.03) accesses the Resultlist by following code snippet:
> …
> query = em.createQuery(selectJPQLStatement.toString());
> if (!query.getResultList().isEmpty()) {
> selectedObject = query.getResultList().get(0);
> …
> Because an injected entityprocessor (via proxy) from the Spring Framework, on the first access to query.getResultList() closes the entitymanager after the query transaction is done.
> Since the object is accessed in a separate call the entitymanager is closed and therefore we get an error “Attempting to execute an operation on a closed EntityManager."
> The solution is ..
> By assigning the ResultList to a List, the issue is solved:
> …
> query = em.createQuery(selectJPQLStatement.toString());
> final List resultList = query.getResultList();
> if (!resultList.isEmpty())
> {
> selectedObject = resultList.get(0);
> }
> …
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)