[
https://issues.apache.org/jira/browse/OOZIE-2095?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14694660#comment-14694660
]
Jadiel de Armas commented on OOZIE-2095:
----------------------------------------
I see another solution, but it touches more parts. Right now, the users of
QueryExecutor classes need to be aware of calling the right method when passing
their queries, otherwise, a runtime exception might be thrown. For example: if
my query returns a list of beans instead of a bean, but I call the
*QueryExecutor.get* method instead of *QueryExecutor.getList* method that will
happen.
The *JPAExecutor* way was nice in that it was not a two-step process where I
first need to create the query, and then I need to pass the query to the right
method to get it executed.
a) Maybe we can create three different types of JPAExecutors:
*SelectJPAExecutor*, *UpdateJPAExecutor* and *DeleteJPAExecutor* (maybe Update
and Delete can be handled as one too).
b) Then we add three (two) new methods to *oozie.service.JPAService* that
handle each of the executors differently (i.e.: for *SelectJPAExecutor* it does
not begin a transaction).
Up to this point, the only modification that we have to do to current code is
to go through each executor class and specify the type of JPAExecutor in the
class declaration line.
So far we solve the problem of getting rid of transactions on SELECT queries,
but we still haven't solved the instantiation problem. For this one we can make
them Singletons and change the signature of the *execute* function on the
JPAExecutor class so that it takes the query parameters in it.
> Convert JPAExecutor classes to QueryExecutor
> --------------------------------------------
>
> Key: OOZIE-2095
> URL: https://issues.apache.org/jira/browse/OOZIE-2095
> Project: Oozie
> Issue Type: Sub-task
> Reporter: Rohini Palaniswamy
> Assignee: Jadiel de Armas
> Labels: newbie
> Time Spent: 1h
> Remaining Estimate: 0h
>
> Need to convert JPAExecutor classes to QueryExecutor. JPAExecutor classes
> are inefficient
> - as a class is instantiated every time to execute a query
> - Uses transaction commits even for reads.
> Some might be difficult to get rid of as we do custom sql construction, but
> most can be converted. For eg: CoordJobsGetPendingJPAExecutor which is only
> called with limit -1.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)