You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by vi...@apache.org on 2013/09/08 04:47:41 UTC

svn commit: r1520829 [1/6] - in /oozie/trunk: ./ core/src/main/java/org/apache/oozie/ core/src/main/java/org/apache/oozie/command/ core/src/main/java/org/apache/oozie/command/bundle/ core/src/main/java/org/apache/oozie/command/coord/ core/src/main/java...

Author: virag
Date: Sun Sep  8 02:47:39 2013
New Revision: 1520829

URL: http://svn.apache.org/r1520829
Log:
OOZIE-1499 Update only necessary columns and consolidate JPA Executors (ryota)

Added:
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BatchQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/QueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/SLARegistrationQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/SLASummaryQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionQueryExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobQueryExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBatchQueryExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobQueryExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestSLARegistrationQueryExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestSLASummaryQueryExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestWorkflowActionQueryExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestWorkflowJobQueryExecutor.java
Removed:
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateDeleteJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateInsertForCoordActionStartJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateInsertForCoordActionStatusJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BulkUpdateInsertJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleActionUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/BundleJobUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBulkUpdateDeleteJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBulkUpdateInsertForCoordActionStartJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBulkUpdateInsertForCoordActionStatusJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestBulkUpdateInsertJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateForInputCheckJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateForModifiedTimeJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordActionUpdateStatusJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobUpdateJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestWorkflowActionUpdateJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestWorkflowJobUpdateJPAExecutor.java
Modified:
    oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowActionBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowJobBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/TransitionXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionMaterializeCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordChangeXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordKillXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordMaterializeTransitionXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordPauseXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordPushDependencyCheckXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordRerunXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordResumeXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSubmitXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordSuspendXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordUnpauseXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ActionCheckXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ActionEndXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ActionKillXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ActionStartXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/KillXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ReRunXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/ResumeXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SignalXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SubmitXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/command/wf/SuspendXCommand.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java
    oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java
    oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java
    oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
    oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
    oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java
    oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java
    oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionsKillXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordChangeXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordKillXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordRerunXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordResumeXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestActionErrors.java
    oozie/trunk/core/src/test/java/org/apache/oozie/command/wf/TestActionStartXCommand.java
    oozie/trunk/core/src/test/java/org/apache/oozie/event/TestEventGeneration.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsCountNotForPurgeFromParentIdJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsGetForPurgeJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestCoordJobsGetFromParentIdJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestWorkflowJobsCountNotForPurgeFromWorkflowParentIdJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/executor/jpa/TestWorkflowJobsGetForPurgeJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/service/TestActionCheckerService.java
    oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPauseTransitService.java
    oozie/trunk/core/src/test/java/org/apache/oozie/service/TestPurgeService.java
    oozie/trunk/core/src/test/java/org/apache/oozie/service/TestStatusTransitService.java
    oozie/trunk/core/src/test/java/org/apache/oozie/servlet/TestV2SLAServlet.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLACalculationJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLACalculatorMemory.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLAEventGeneration.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLARegistrationGetJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLARegistrationGetRecordsOnRestartJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLAService.java
    oozie/trunk/core/src/test/java/org/apache/oozie/sla/TestSLASummaryGetOnRestartJPAExecutor.java
    oozie/trunk/core/src/test/java/org/apache/oozie/test/XDataTestCase.java
    oozie/trunk/core/src/test/java/org/apache/oozie/test/XTestCase.java
    oozie/trunk/release-log.txt

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/BundleActionBean.java Sun Sep  8 02:47:39 2013
@@ -43,6 +43,12 @@ import org.json.simple.JSONObject;
 @NamedQueries( {
         @NamedQuery(name = "DELETE_BUNDLE_ACTION", query = "delete from BundleActionBean w where w.bundleActionId = :bundleActionId"),
 
+        @NamedQuery(name = "UPDATE_BUNDLE_ACTION_PENDING_MODTIME", query = "update BundleActionBean w set w.lastModifiedTimestamp = :lastModifiedTimestamp, w.pending = :pending where w.bundleActionId = :bundleActionId"),
+
+        @NamedQuery(name = "UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME", query = "update BundleActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.pending = :pending where w.bundleActionId = :bundleActionId"),
+
+        @NamedQuery(name = "UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID", query = "update BundleActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.pending = :pending, w.coordId = :coordId where w.bundleActionId = :bundleActionId"),
+
         @NamedQuery(name = "GET_BUNDLE_ACTIONS_FOR_BUNDLE", query = "select OBJECT(w) from BundleActionBean w where w.bundleId = :bundleId"),
 
         @NamedQuery(name = "GET_BUNDLE_ACTION_STATUS_PENDING_FOR_BUNDLE", query = "select w.coordId, w.statusStr, w.pending from BundleActionBean w where w.bundleId = :bundleId"),

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/BundleJobBean.java Sun Sep  8 02:47:39 2013
@@ -57,6 +57,16 @@ import org.json.simple.JSONObject;
 
         @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS", query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTimestamp, w.pending = :pending where w.id = :id"),
 
+        @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS_PENDING", query = "update BundleJobBean w set w.statusStr = :status, w.pending = :pending where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME", query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME", query = "update BundleJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending, w.suspendedTimestamp = :suspendedTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME", query = "update BundleJobBean w set w.statusStr = :status, w.pauseTimestamp = :pauseTime, w.endTimestamp = :endTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_BUNDLE_JOB_PAUSE_KICKOFF", query = "update BundleJobBean w set w.kickoffTimestamp = :kickoffTime, w.pauseTimestamp = :pauseTime where w.id = :id"),
+
         @NamedQuery(name = "DELETE_BUNDLE_JOB", query = "delete from BundleJobBean w where w.id = :id"),
 
         @NamedQuery(name = "GET_BUNDLE_JOBS", query = "select OBJECT(w) from BundleJobBean w"),

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorActionBean.java Sun Sep  8 02:47:39 2013
@@ -66,11 +66,15 @@ import org.json.simple.JSONObject;
         @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_INPUTCHECK", query = "update CoordinatorActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.actionXml = :actionXml, w.missingDependencies = :missingDependencies where w.id = :id"),
         // Update query for Push-based missing dependency check
         @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK", query = "update CoordinatorActionBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime,  w.actionXml = :actionXml, w.pushMissingDependencies = :pushMissingDependencies where w.id = :id"),
+        // Update query for Push-based missing dependency check
+        @NamedQuery(name = "UPDATE_COORD_ACTION_DEPENDENCIES", query = "update CoordinatorActionBean w set w.missingDependencies = :missingDependencies, w.pushMissingDependencies = :pushMissingDependencies where w.id = :id"),
         // Update query for Start
         @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_START", query = "update CoordinatorActionBean w set w.statusStr =:status, w.lastModifiedTimestamp = :lastModifiedTime, w.runConf = :runConf, w.externalId = :externalId, w.pending = :pending, w.errorCode = :errorCode, w.errorMessage = :errorMessage  where w.id = :id"),
 
         @NamedQuery(name = "UPDATE_COORD_ACTION_FOR_MODIFIED_DATE", query = "update CoordinatorActionBean w set w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
 
+        @NamedQuery(name = "UPDATE_COORD_ACTION_RERUN", query = "update CoordinatorActionBean w set w.actionXml =:actionXml, w.statusStr = :status, w.externalId = :externalId, w.externalStatus = :externalStatus, w.rerunTimestamp = :rerunTime, w.lastModifiedTimestamp = :lastModifiedTime, w.createdTimestamp = :createdTime where w.id = :id"),
+
         @NamedQuery(name = "DELETE_COMPLETED_ACTIONS_FOR_COORDINATOR", query = "delete from CoordinatorActionBean a where a.jobId = :jobId and (a.statusStr = 'SUCCEEDED' OR a.statusStr = 'FAILED' OR a.statusStr= 'KILLED')"),
 
         @NamedQuery(name = "DELETE_ACTIONS_FOR_COORDINATOR", query = "delete from CoordinatorActionBean a where a.jobId = :jobId"),

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/CoordinatorJobBean.java Sun Sep  8 02:47:39 2013
@@ -56,6 +56,26 @@ import org.json.simple.JSONObject;
 
         @NamedQuery(name = "UPDATE_COORD_JOB_PENDING", query = "update CoordinatorJobBean w set w.pending = :pending, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
 
+        @NamedQuery(name = "UPDATE_COORD_JOB_BUNDLEID", query = "update CoordinatorJobBean w set w.bundleId = :bundleId where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_APPNAMESPACE", query = "update CoordinatorJobBean w set w.appNamespace = :appNamespace where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_STATUS_PENDING", query = "update CoordinatorJobBean w set w.statusStr = :status, w.pending = :pending where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_BUNDLEID_APPNAMESPACE_PAUSETIME", query = "update CoordinatorJobBean w set w.bundleId = :bundleId, w.appNamespace = :appNamespace, w.pauseTimestamp = :pauseTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_STATUS_MODTIME", query = "update CoordinatorJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_STATUS_PENDING_MODTIME", query = "update CoordinatorJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModifiedTime, w.pending = :pending where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_LAST_MODIFIED_TIME", query = "update CoordinatorJobBean w set w.lastModifiedTimestamp = :lastModifiedTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_STATUS_PENDING_TIME", query = "update CoordinatorJobBean w set w.statusStr = :status, w.pending = :pending, w.doneMaterialization = :doneMaterialization, w.lastModifiedTimestamp = :lastModifiedTime, w.suspendedTimestamp = :suspendedTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_MATERIALIZE", query = "update CoordinatorJobBean w set w.statusStr = :status, w.pending = :pending, w.doneMaterialization = :doneMaterialization, w.lastActionTimestamp = :lastActionTime, w.lastActionNumber = :lastActionNumber, w.nextMaterializedTimestamp = :nextMatdTime where w.id = :id"),
+
+        @NamedQuery(name = "UPDATE_COORD_JOB_CHANGE", query = "update CoordinatorJobBean w set w.endTimestamp = :endTime, w.statusStr = :status, w.pending = :pending, w.doneMaterialization = :doneMaterialization, w.concurrency = :concurrency, w.pauseTimestamp = :pauseTime, w.lastActionNumber = :lastActionNumber, w.lastActionTimestamp = :lastActionTime, w.nextMaterializedTimestamp = :nextMatdTime where w.id = :id"),
+
         @NamedQuery(name = "DELETE_COORD_JOB", query = "delete from CoordinatorJobBean w where w.id = :id"),
 
         @NamedQuery(name = "GET_COORD_JOBS", query = "select OBJECT(w) from CoordinatorJobBean w"),
@@ -725,6 +745,10 @@ public class CoordinatorJobBean implemen
         return DateUtils.toDate(pauseTimestamp);
     }
 
+    public Timestamp getPauseTimestamp() {
+        return pauseTimestamp;
+    }
+
     /**
      * Set created time
      *

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowActionBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowActionBean.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowActionBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowActionBean.java Sun Sep  8 02:47:39 2013
@@ -56,6 +56,22 @@ import org.json.simple.JSONObject;
 
     @NamedQuery(name = "UPDATE_ACTION", query = "update WorkflowActionBean a set a.conf = :conf, a.consoleUrl = :consoleUrl, a.data = :data, a.stats = :stats, a.externalChildIDs = :externalChildIDs, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.externalId = :externalId, a.externalStatus = :externalStatus, a.name = :name, a.cred = :cred , a.retries = :retries, a.trackerUri = :trackerUri, a.transition = :transition, a.type = :type, a.endTimestamp = :endTime, a.executionPath = :executionPath, a.lastCheckTimestamp = :lastCheckTime, a.logToken = :logToken, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.signalValue = :signalValue, a.slaXml = :slaXml, a.startTimestamp = :startTime, a.statusStr = :status, a.wfId=:wfId where a.id = :id"),
 
+    @NamedQuery(name = "UPDATE_ACTION_FOR_LAST_CHECKED_TIME", query = "update WorkflowActionBean a set a.lastCheckTimestamp = :lastCheckTime where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_START", query = "update WorkflowActionBean a set a.startTimestamp = :startTime, a.externalChildIDs = :externalChildIDs, a.conf = :conf, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.startTimestamp = :startTime, a.externalId = :externalId, a.trackerUri = :trackerUri, a.consoleUrl = :consoleUrl, a.lastCheckTimestamp = :lastCheckTime, a.statusStr = :status, a.externalStatus = :externalStatus, a.data = :data, a.retries = :retries, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.userRetryCount = :userRetryCount where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_CHECK", query = "update WorkflowActionBean a set a.externalChildIDs = :externalChildIDs, a.externalStatus = :externalStatus, a.statusStr = :status, a.data = :data, a.pending = :pending, a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.lastCheckTimestamp = :lastCheckTime, a.retries = :retries, a.pendingAgeTimestamp = :pendingAge, a.startTimestamp = :startTime where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_END", query = "update WorkflowActionBean a set a.errorCode = :errorCode, a.errorMessage = :errorMessage, a.retries = :retries, a.endTimestamp = :endTime, a.statusStr = :status, a.pending = :pending, a.pendingAgeTimestamp = :pendingAge, a.signalValue = :signalValue, a.userRetryCount = :userRetryCount, a.externalStatus = :externalStatus where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_PENDING", query = "update WorkflowActionBean a set a.pending = :pending where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_STATUS_PENDING", query = "update WorkflowActionBean a set a.statusStr = :status, a.pending = :pending where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_PENDING_TRANS", query = "update WorkflowActionBean a set a.pending = :pending, a.transition = :transition where a.id = :id"),
+
+    @NamedQuery(name = "UPDATE_ACTION_PENDING_TRANS_ERROR", query = "update WorkflowActionBean a set a.pending = :pending, a.transition = :transition, a.errorCode = :errorCode, a.errorMessage = :errorMessage where a.id = :id"),
+
     @NamedQuery(name = "DELETE_ACTION", query = "delete from WorkflowActionBean a where a.id = :id"),
 
     @NamedQuery(name = "DELETE_ACTIONS_FOR_WORKFLOW", query = "delete from WorkflowActionBean a where a.wfId = :wfId"),
@@ -711,12 +727,8 @@ public class WorkflowActionBean implemen
         this.lastCheckTimestamp = DateUtils.convertDateToTimestamp(lastCheckTime);
     }
 
-    /**
-     * Get pending
-     * @return
-     */
-    public boolean getPending() {
-        return this.pending == 1 ? true : false;
+    public int getPending() {
+        return this.pending;
     }
 
     @Override

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowJobBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowJobBean.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowJobBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/WorkflowJobBean.java Sun Sep  8 02:47:39 2013
@@ -58,6 +58,20 @@ import org.json.simple.JSONObject;
 
     @NamedQuery(name = "UPDATE_WORKFLOW", query = "update WorkflowJobBean w set w.appName = :appName, w.appPath = :appPath, w.conf = :conf, w.group = :groupName, w.run = :run, w.user = :user, w.createdTimestamp = :createdTime, w.endTimestamp = :endTime, w.externalId = :externalId, w.lastModifiedTimestamp = :lastModTime,w.logToken = :logToken, w.protoActionConf = :protoActionConf, w.slaXml =:slaXml, w.startTimestamp = :startTime, w.statusStr = :status, w.wfInstance = :wfInstance where w.id = :id"),
 
+    @NamedQuery(name = "UPDATE_WORKFLOW_MODTIME", query = "update WorkflowJobBean w set w.lastModifiedTimestamp = :lastModTime where w.id = :id"),
+
+    @NamedQuery(name = "UPDATE_WORKFLOW_STATUS_MODTIME", query = "update WorkflowJobBean w set w.statusStr = :status, w.lastModifiedTimestamp = :lastModTime where w.id = :id"),
+
+    @NamedQuery(name = "UPDATE_WORKFLOW_PARENT_MODIFIED", query = "update WorkflowJobBean w set w.parentId = :parentId, w.lastModifiedTimestamp = :lastModTime where w.id = :id"),
+
+    @NamedQuery(name = "UPDATE_WORKFLOW_STATUS_INSTANCE_MODIFIED", query = "update WorkflowJobBean w set w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime where w.id = :id"),
+
+    @NamedQuery(name = "UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_END", query = "update WorkflowJobBean w set w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime, w.endTimestamp = :endTime where w.id = :id"),
+
+    @NamedQuery(name = "UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_START_END", query = "update WorkflowJobBean w set w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime, w.startTimestamp = :startTime, w.endTimestamp = :endTime where w.id = :id"),
+
+    @NamedQuery(name = "UPDATE_WORKFLOW_RERUN", query = "update WorkflowJobBean w set w.appName = :appName, w.protoActionConf = :protoActionConf, w.appPath = :appPath, w.conf = :conf, w.logToken = :logToken, w.user = :user, w.group = :group, w.externalId = :externalId, w.endTimestamp = :endTime, w.run = :run, w.statusStr = :status, w.wfInstance = :wfInstance, w.lastModifiedTimestamp = :lastModTime where w.id = :id"),
+
     @NamedQuery(name = "DELETE_WORKFLOW", query = "delete from WorkflowJobBean w where w.id = :id"),
 
     @NamedQuery(name = "GET_WORKFLOWS", query = "select OBJECT(w) from WorkflowJobBean w order by w.startTimestamp desc"),
@@ -309,14 +323,6 @@ public class WorkflowJobBean implements 
         this.protoActionConf = protoActionConf;
     }
 
-    public String getprotoActionConf() {
-        return protoActionConf;
-    }
-
-    public String getlogToken() {
-        return logToken;
-    }
-
     public Timestamp getLastModifiedTimestamp() {
         return lastModifiedTimestamp;
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/TransitionXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/TransitionXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/TransitionXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/TransitionXCommand.java Sun Sep  8 02:47:39 2013
@@ -25,6 +25,7 @@ import org.apache.oozie.CoordinatorJobBe
 import org.apache.oozie.client.Job;
 import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.command.coord.CoordinatorXCommand;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
 import org.apache.oozie.util.ParamChecker;
 
 /**
@@ -36,7 +37,7 @@ import org.apache.oozie.util.ParamChecke
 public abstract class TransitionXCommand<T> extends XCommand<T> {
 
     protected Job job;
-    protected List<JsonBean> updateList = new ArrayList<JsonBean>();
+    protected List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
     protected List<JsonBean> insertList = new ArrayList<JsonBean>();
 
     public TransitionXCommand(String name, String type, int priority) {
@@ -77,7 +78,8 @@ public abstract class TransitionXCommand
      * @throws CommandException
      */
     public void generateEvents(CoordinatorJobBean coordJob) throws CommandException {
-        for (JsonBean actionBean : updateList) {
+        for(UpdateEntry entry : updateList){
+            JsonBean actionBean = entry.getBean();
             if (actionBean instanceof CoordinatorActionBean) {
                 CoordinatorActionBean caBean = (CoordinatorActionBean) actionBean;
                 caBean.setJobId(coordJob.getId());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobChangeXCommand.java Sun Sep  8 02:47:39 2013
@@ -30,14 +30,16 @@ import org.apache.oozie.ErrorCode;
 import org.apache.oozie.XException;
 import org.apache.oozie.client.Job;
 import org.apache.oozie.client.OozieClient;
-import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.XCommand;
 import org.apache.oozie.command.coord.CoordChangeXCommand;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
@@ -56,7 +58,7 @@ public class BundleJobChangeXCommand ext
     private Date newEndTime = null;
     boolean isChangePauseTime = false;
     boolean isChangeEndTime = false;
-    private List<JsonBean> updateList = new ArrayList<JsonBean>();
+    private List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
 
     private static final Set<String> ALLOWED_CHANGE_OPTIONS = new HashSet<String>();
     static {
@@ -113,7 +115,9 @@ public class BundleJobChangeXCommand ext
     private void validateChangeValue(String changeValue) throws CommandException {
         Map<String, String> map = JobUtils.parseChangeValue(changeValue);
 
-        if (map.size() > ALLOWED_CHANGE_OPTIONS.size() || !(map.containsKey(OozieClient.CHANGE_VALUE_PAUSETIME) || map.containsKey(OozieClient.CHANGE_VALUE_ENDTIME))) {
+        if (map.size() > ALLOWED_CHANGE_OPTIONS.size()
+                || !(map.containsKey(OozieClient.CHANGE_VALUE_PAUSETIME) || map
+                        .containsKey(OozieClient.CHANGE_VALUE_ENDTIME))) {
             throw new CommandException(ErrorCode.E1317, changeValue, "can only change pausetime or end time");
         }
 
@@ -181,11 +185,13 @@ public class BundleJobChangeXCommand ext
                         LOG.info("Queuing CoordChangeXCommand coord job = " + action.getCoordId() + " to change "
                                 + changeValue);
                         action.setPending(action.getPending() + 1);
-                        updateList.add(action);
+                        updateList.add(new UpdateEntry<BundleActionQuery>(
+                                BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME, action));
                     }
                 }
-                updateList.add(bundleJob);
-                jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, null));
+                updateList.add(new UpdateEntry<BundleJobQuery>(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PAUSE_ENDTIME,
+                        bundleJob));
+                BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
             }
             return null;
         }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobResumeXCommand.java Sun Sep  8 02:47:39 2013
@@ -28,10 +28,13 @@ import org.apache.oozie.command.CommandE
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.ResumeTransitionXCommand;
 import org.apache.oozie.command.coord.CoordResumeXCommand;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.InstrumentUtils;
@@ -92,7 +95,7 @@ public class BundleJobResumeXCommand ext
         }
         action.incrementAndGetPending();
         action.setLastModifiedTime(new Date());
-        updateList.add(action);
+        updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
     }
 
     /* (non-Javadoc)
@@ -112,7 +115,7 @@ public class BundleJobResumeXCommand ext
         bundleJob.setSuspendedTime(null);
         bundleJob.setLastModifiedTime(new Date());
         LOG.debug("Resume bundle job id = " + bundleId + ", status = " + bundleJob.getStatus() + ", pending = " + bundleJob.isPending());
-        updateList.add(bundleJob);
+        updateList.add(new UpdateEntry<BundleJobQuery>(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME, bundleJob));
     }
 
     /* (non-Javadoc)
@@ -121,7 +124,7 @@ public class BundleJobResumeXCommand ext
     @Override
     public void performWrites() throws CommandException {
         try {
-            jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, null));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleJobSuspendXCommand.java Sun Sep  8 02:47:39 2013
@@ -28,10 +28,13 @@ import org.apache.oozie.command.CommandE
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.SuspendTransitionXCommand;
 import org.apache.oozie.command.coord.CoordSuspendXCommand;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.InstrumentUtils;
@@ -77,7 +80,7 @@ public class BundleJobSuspendXCommand ex
     @Override
     public void performWrites() throws CommandException {
         try {
-            jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, null));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);
@@ -150,7 +153,7 @@ public class BundleJobSuspendXCommand ex
         bundleJob.setLastModifiedTime(new Date());
 
         LOG.debug("Suspend bundle job id = " + jobId + ", status = " + bundleJob.getStatus() + ", pending = " + bundleJob.isPending());
-        updateList.add(bundleJob);
+        updateList.add(new UpdateEntry<BundleJobQuery>(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_SUSP_MOD_TIME, bundleJob));
     }
 
     @Override
@@ -195,6 +198,7 @@ public class BundleJobSuspendXCommand ex
 
         action.incrementAndGetPending();
         action.setLastModifiedTime(new Date());
-        updateList.add(action);
+        updateList.add(new UpdateEntry<BundleActionQuery>(
+                BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
     }
 }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleKillXCommand.java Sun Sep  8 02:47:39 2013
@@ -29,9 +29,12 @@ import org.apache.oozie.command.CommandE
 import org.apache.oozie.command.KillTransitionXCommand;
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.coord.CoordKillXCommand;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
@@ -144,7 +147,7 @@ public class BundleKillXCommand extends 
             action.incrementAndGetPending();
             action.setStatus(Job.Status.KILLED);
         }
-        updateList.add(action);
+        updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME, action));
     }
 
     /* (non-Javadoc)
@@ -167,7 +170,7 @@ public class BundleKillXCommand extends 
      */
     @Override
     public void updateJob() {
-        updateList.add(bundleJob);
+        updateList.add(new UpdateEntry<BundleJobQuery>(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME, bundleJob));
     }
 
     /* (non-Javadoc)
@@ -176,7 +179,7 @@ public class BundleKillXCommand extends 
     @Override
     public void performWrites() throws CommandException {
         try {
-            jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, null));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundlePauseXCommand.java Sun Sep  8 02:47:39 2013
@@ -22,15 +22,13 @@ import org.apache.oozie.client.Job;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PauseTransitionXCommand;
 import org.apache.oozie.command.PreconditionException;
-import org.apache.oozie.executor.jpa.BundleJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
-import org.apache.oozie.service.JPAService;
-import org.apache.oozie.service.Services;
 import org.apache.oozie.util.LogUtils;
 
 public class BundlePauseXCommand extends PauseTransitionXCommand {
     private BundleJobBean bundleJob;
-    private JPAService jpaService = Services.get().get(JPAService.class);
 
     public BundlePauseXCommand(BundleJobBean bundleJob) {
         super("bundle_pause", "bundle_pause", 1);
@@ -89,7 +87,7 @@ public class BundlePauseXCommand extends
     @Override
     public void updateJob() throws CommandException {
         try {
-            jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
+            BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS, bundleJob);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleRerunXCommand.java Sun Sep  8 02:47:39 2013
@@ -32,11 +32,14 @@ import org.apache.oozie.client.rest.Rest
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.RerunTransitionXCommand;
 import org.apache.oozie.command.coord.CoordRerunXCommand;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
@@ -197,7 +200,7 @@ public class BundleRerunXCommand extends
     private void updateBundleAction(BundleActionBean action) {
         action.incrementAndGetPending();
         action.setLastModifiedTime(new Date());
-        updateList.add(action);
+        updateList.add(new UpdateEntry<BundleActionQuery>(BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME, action));
     }
 
     /* (non-Javadoc)
@@ -218,7 +221,7 @@ public class BundleRerunXCommand extends
                 }
             }
         }
-        updateList.add(bundleJob);
+        updateList.add(new UpdateEntry<BundleJobQuery>(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING, bundleJob));
     }
 
     /* (non-Javadoc)
@@ -227,7 +230,7 @@ public class BundleRerunXCommand extends
     @Override
     public void performWrites() throws CommandException {
         try {
-            jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, null));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStartXCommand.java Sun Sep  8 02:47:39 2013
@@ -37,10 +37,12 @@ import org.apache.oozie.command.CommandE
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.StartTransitionXCommand;
 import org.apache.oozie.command.coord.CoordSubmitXCommand;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
-import org.apache.oozie.executor.jpa.BundleJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.JobUtils;
@@ -176,7 +178,7 @@ public class BundleStartXCommand extends
     @Override
     public void performWrites() throws CommandException {
         try {
-            jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, insertList));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, updateList, null);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);
@@ -222,7 +224,7 @@ public class BundleStartXCommand extends
                 bundleJob.setStatus(Job.Status.FAILED);
                 bundleJob.resetPending();
                 try {
-                    jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
+                    BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING, bundleJob);
                 }
                 catch (JPAExecutorException jex) {
                     throw new CommandException(jex);
@@ -365,6 +367,6 @@ public class BundleStartXCommand extends
      */
     @Override
     public void updateJob() throws CommandException {
-        updateList.add(bundleJob);
+        updateList.add(new UpdateEntry<BundleJobQuery>(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING, bundleJob));
     }
 }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleStatusUpdateXCommand.java Sun Sep  8 02:47:39 2013
@@ -28,8 +28,10 @@ import org.apache.oozie.client.Job;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.StatusUpdateXCommand;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.BundleActionGetJPAExecutor;
-import org.apache.oozie.executor.jpa.BundleActionUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor;
+import org.apache.oozie.executor.jpa.BundleActionQueryExecutor.BundleActionQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
@@ -83,10 +85,14 @@ public class BundleStatusUpdateXCommand 
 
             bundleaction.setLastModifiedTime(new Date());
             bundleaction.setCoordId(coordjob.getId());
-            jpaService.execute(new BundleActionUpdateJPAExecutor(bundleaction));
+            BundleActionQueryExecutor.getInstance().executeUpdate(
+                    BundleActionQuery.UPDATE_BUNDLE_ACTION_STATUS_PENDING_MODTIME_COORDID, bundleaction);
             if (bundleaction.getCoordId() != null) {
-                LOG.info("Updated bundle action [{0}] from prev status [{1}] to current coord status [{2}], and new bundle action pending [{3}]", bundleaction
-                    .getBundleActionId(), bundleaction.getStatus(), coordCurrentStatus, bundleaction.getPending());
+                LOG.info(
+                        "Updated bundle action [{0}] from prev status [{1}] to current coord status [{2}], " +
+                        "and new bundle action pending [{3}]",
+                        bundleaction.getBundleActionId(), bundleaction.getStatus(), coordCurrentStatus,
+                        bundleaction.getPending());
             }
             else {
                 LOG.info("Updated Bundle action [{0}], status = [{1}], pending = [{2}]", bundleaction.getBundleActionId(),
@@ -162,18 +168,22 @@ public class BundleStatusUpdateXCommand 
             }
             bundleaction.setLastModifiedTime(new Date());
             try {
-                jpaService.execute(new BundleActionUpdateJPAExecutor(bundleaction));
+                BundleActionQueryExecutor.getInstance().executeUpdate(
+                        BundleActionQuery.UPDATE_BUNDLE_ACTION_PENDING_MODTIME, bundleaction);
             }
             catch (JPAExecutorException je) {
                 throw new CommandException(je);
             }
-            LOG.info("Bundle action [{0}] status [{1}] is different from prev coord status [{2}], decrement pending so new pending = [{3}]",
+            LOG.info("Bundle action [{0}] status [{1}] is different from prev coord status [{2}], " +
+            "decrement pending so new pending = [{3}]",
                             bundleaction.getBundleActionId(), bundleaction.getStatusStr(), prevStatus.toString(),
                             bundleaction.getPending());
             throw new PreconditionException(ErrorCode.E1308, bundleaction.getStatusStr(), prevStatus.toString());
         }
         else if (bundleaction.getStatusStr().compareToIgnoreCase(prevStatus.toString()) != 0) {
-            LOG.info("Bundle action [{0}] status [{1}] is different from prev coord status [{2}], pending = [{3}] and bundle not yet updated with coord-id",
+            LOG.info(
+                    "Bundle action [{0}] status [{1}] is different from prev coord status [{2}], " +
+                    "pending = [{3}] and bundle not yet updated with coord-id",
                     bundleaction.getBundleActionId(), bundleaction.getStatusStr(), prevStatus.toString(),
                     bundleaction.getPending());
         }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleSubmitXCommand.java Sun Sep  8 02:47:39 2013
@@ -43,7 +43,7 @@ import org.apache.oozie.client.OozieClie
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.SubmitTransitionXCommand;
-import org.apache.oozie.executor.jpa.BundleJobInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
 import org.apache.oozie.service.HadoopAccessorException;
 import org.apache.oozie.service.HadoopAccessorService;
 import org.apache.oozie.service.JPAService;
@@ -419,7 +419,7 @@ public class BundleSubmitXCommand extend
             bundleJob.setLastModifiedTime(new Date());
 
             if (!dryrun) {
-                jpaService.execute(new BundleJobInsertJPAExecutor(bundleJob));
+                BundleJobQueryExecutor.getInstance().insert(bundleJob);
             }
         }
         catch (Exception ex) {

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/bundle/BundleUnpauseXCommand.java Sun Sep  8 02:47:39 2013
@@ -22,8 +22,9 @@ import org.apache.oozie.client.Job;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.UnpauseTransitionXCommand;
-import org.apache.oozie.executor.jpa.BundleJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.BundleJobQueryExecutor.BundleJobQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.LogUtils;
@@ -103,7 +104,7 @@ public class BundleUnpauseXCommand exten
     @Override
     public void updateJob() throws CommandException {
         try {
-            jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
+            BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS, bundleJob);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionCheckXCommand.java Sun Sep  8 02:47:39 2013
@@ -20,7 +20,9 @@ package org.apache.oozie.command.coord;
 import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.oozie.CoordinatorActionBean;
 import org.apache.oozie.CoordinatorJobBean;
@@ -42,10 +44,13 @@ import org.apache.oozie.client.SLAEvent.
 import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertForCoordActionStatusJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordActionGetForCheckJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordinatorJobGetForUserAppnameJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobGetForSLAJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 
 /**
  * The command checks workflow status for coordinator action.
@@ -58,7 +63,7 @@ public class CoordActionCheckXCommand ex
     private CoordinatorJobBean coordJob;
     private WorkflowJobBean workflowJob;
     private JPAService jpaService = null;
-    private List<JsonBean> updateList = new ArrayList<JsonBean>();
+    private List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
     private List<JsonBean> insertList = new ArrayList<JsonBean>();
 
     public CoordActionCheckXCommand(String actionId, int actionCheckDelay) {
@@ -100,17 +105,19 @@ public class CoordActionCheckXCommand ex
                     else {
                         LOG.warn("Unexpected workflow " + workflowJob.getId() + " STATUS " + workflowJob.getStatus());
                         coordAction.setLastModifiedTime(new Date());
-                        updateList.add(coordAction);
-                        jpaService.execute(new BulkUpdateInsertForCoordActionStatusJPAExecutor(updateList, null));
+                        CoordActionQueryExecutor.getInstance().executeUpdate(
+                                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_MODIFIED_DATE,
+                                coordAction);
                         return null;
                     }
                 }
             }
 
-            LOG.debug("Updating Coordintaor actionId :" + coordAction.getId() + "status to ="
+            LOG.debug("Updating Coordinator actionId :" + coordAction.getId() + "status to ="
                             + coordAction.getStatus());
             coordAction.setLastModifiedTime(new Date());
-            updateList.add(coordAction);
+            updateList.add(new UpdateEntry<CoordActionQuery>(CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME,
+                    coordAction));
 
             if (slaStatus != null) {
                 SLAEventBean slaEvent = SLADbOperations.createStatusEvent(coordAction.getSlaXml(), coordAction.getId(), slaStatus,
@@ -120,7 +127,7 @@ public class CoordActionCheckXCommand ex
                 }
             }
 
-            jpaService.execute(new BulkUpdateInsertForCoordActionStatusJPAExecutor(updateList, insertList));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, updateList, null);
             CoordinatorAction.Status endStatus = coordAction.getStatus();
             if (endStatus != initialStatus && EventHandlerService.isEnabled()) {
                 generateEvent(coordAction, coordJob.getUser(), coordJob.getAppName(), workflowJob.getStartTime());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionInputCheckXCommand.java Sun Sep  8 02:47:39 2013
@@ -38,8 +38,8 @@ import org.apache.oozie.coord.CoordELFun
 import org.apache.oozie.dependency.URIHandler;
 import org.apache.oozie.dependency.URIHandlerException;
 import org.apache.oozie.executor.jpa.CoordActionGetForInputCheckJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordActionUpdateForModifiedTimeJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.CallableQueueService;
@@ -208,15 +208,17 @@ public class CoordActionInputCheckXComma
         if (jpaService != null) {
             try {
                 if (isChangeInDependency) {
-                    jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(coordAction));
-                    if (EventHandlerService.isEnabled()
-                            && coordAction.getStatus() != CoordinatorAction.Status.READY) {
-                        //since event is not to be generated unless action RUNNING via StartX
+                    CoordActionQueryExecutor.getInstance().executeUpdate(
+                            CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK, coordAction);
+                    if (EventHandlerService.isEnabled() && coordAction.getStatus() != CoordinatorAction.Status.READY) {
+                        // since event is not to be generated unless action
+                        // RUNNING via StartX
                         generateEvent(coordAction, coordJob.getUser(), coordJob.getAppName(), null);
                     }
                 }
                 else {
-                    jpaService.execute(new CoordActionUpdateForModifiedTimeJPAExecutor(coordAction));
+                    CoordActionQueryExecutor.getInstance().executeUpdate(
+                            CoordActionQuery.UPDATE_COORD_ACTION_FOR_MODIFIED_DATE, coordAction);
                 }
             }
             catch (JPAExecutorException jex) {

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionMaterializeCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionMaterializeCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionMaterializeCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionMaterializeCommand.java Sun Sep  8 02:47:39 2013
@@ -36,8 +36,10 @@ import org.apache.oozie.client.SLAEvent.
 import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.coord.TimeUnit;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Service;
@@ -63,7 +65,7 @@ public class CoordActionMaterializeComma
     private String user;
     private String group;
     private List<JsonBean> insertList = new ArrayList<JsonBean>();
-    private List<JsonBean> updateList = new ArrayList<JsonBean>();
+    private List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
 
     /**
      * Default timeout for catchup jobs, in minutes, after which coordinator input check will timeout
@@ -107,7 +109,7 @@ public class CoordActionMaterializeComma
             if (job.getStatus() == CoordinatorJob.Status.PREMATER) {
                 job.setStatus(CoordinatorJob.Status.RUNNING);
             }
-            updateList.add(job);
+            updateList.add(new UpdateEntry<CoordJobQuery>(CoordJobQuery.UPDATE_COORD_JOB_STATUS, job));
             return null;
         }
 
@@ -134,7 +136,7 @@ public class CoordActionMaterializeComma
             catch (CommandException ex) {
                 log.warn("Exception occurs:" + ex + " Making the job failed ");
                 job.setStatus(CoordinatorJobBean.Status.FAILED);
-                updateList.add(job);
+                updateList.add(new UpdateEntry<CoordJobQuery>(CoordJobQuery.UPDATE_COORD_JOB_MATERIALIZE, job));
             }
             catch (Exception e) {
                 log.error("Excepion thrown :", e);
@@ -304,7 +306,7 @@ public class CoordActionMaterializeComma
             log.info("[" + job.getId() + "]: Update status from PREMATER to RUNNING");
         }
         job.setNextMaterializedTime(endTime);
-        updateList.add(job);
+        updateList.add(new UpdateEntry<CoordJobQuery>(CoordJobQuery.UPDATE_COORD_JOB_MATERIALIZE, job));
     }
 
     @Override
@@ -317,7 +319,7 @@ public class CoordActionMaterializeComma
                 JPAService jpaService = Services.get().get(JPAService.class);
                 if (jpaService != null) {
                     try {
-                        jpaService.execute(new BulkUpdateInsertJPAExecutor(updateList, insertList));
+                        BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, updateList, null);
                     }
                     catch (JPAExecutorException je) {
                         throw new CommandException(je);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionReadyXCommand.java Sun Sep  8 02:47:39 2013
@@ -26,6 +26,8 @@ import org.apache.oozie.client.Coordinat
 import org.apache.oozie.client.Job;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 import org.apache.oozie.executor.jpa.CoordJobGetReadyActionsJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetRunningActionsCountJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
@@ -111,7 +113,8 @@ public class CoordActionReadyXCommand ex
                 queue(new CoordActionStartXCommand(action.getId(), user, coordJob.getAppName(),
                         action.getJobId()), 100);
                 try {
-                    jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateStatusJPAExecutor(action));
+                    CoordActionQueryExecutor.getInstance().executeUpdate(
+                            CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME, action);
                 }
                 catch (JPAExecutorException je) {
                     throw new CommandException(je);
@@ -158,7 +161,9 @@ public class CoordActionReadyXCommand ex
 
     @Override
     protected void verifyPrecondition() throws CommandException, PreconditionException {
-        if (coordJob.getStatus() != Job.Status.RUNNING && coordJob.getStatus() != Job.Status.RUNNINGWITHERROR && coordJob.getStatus() != Job.Status.SUCCEEDED && coordJob.getStatus() != Job.Status.PAUSED && coordJob.getStatus() != Job.Status.PAUSEDWITHERROR) {
+        if (coordJob.getStatus() != Job.Status.RUNNING && coordJob.getStatus() != Job.Status.RUNNINGWITHERROR
+                && coordJob.getStatus() != Job.Status.SUCCEEDED && coordJob.getStatus() != Job.Status.PAUSED
+                && coordJob.getStatus() != Job.Status.PAUSEDWITHERROR) {
             throw new PreconditionException(ErrorCode.E1100, "[" + jobId
                     + "]::CoordActionReady:: Ignoring job. Coordinator job is not in RUNNING state, but state="
                     + coordJob.getStatus());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionStartXCommand.java Sun Sep  8 02:47:39 2013
@@ -43,9 +43,12 @@ import org.apache.oozie.util.db.SLADbOpe
 import org.apache.oozie.client.SLAEvent.SlaAppType;
 import org.apache.oozie.client.SLAEvent.Status;
 import org.apache.oozie.client.rest.JsonBean;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertForCoordActionStartJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor.WorkflowJobQuery;
 import org.jdom.Element;
 import org.jdom.JDOMException;
 
@@ -53,7 +56,9 @@ import java.io.IOException;
 import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Date;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @SuppressWarnings("deprecation")
 public class CoordActionStartXCommand extends CoordinatorXCommand<Void> {
@@ -71,7 +76,7 @@ public class CoordActionStartXCommand ex
     private CoordinatorActionBean coordAction = null;
     private JPAService jpaService = null;
     private String jobId = null;
-    private List<JsonBean> updateList = new ArrayList<JsonBean>();
+    private List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
     private List<JsonBean> insertList = new ArrayList<JsonBean>();
 
     public CoordActionStartXCommand(String id, String user, String appName, String jobId) {
@@ -186,10 +191,13 @@ public class CoordActionStartXCommand ex
                     WorkflowJobBean wfJob = jpaService.execute(new WorkflowJobGetJPAExecutor(wfId));
                     wfJob.setParentId(actionId);
                     wfJob.setLastModifiedTime(new Date());
-                    updateList.add(wfJob);
-                    updateList.add(coordAction);
+                    BatchQueryExecutor executor = BatchQueryExecutor.getInstance();
+                    updateList.add(new UpdateEntry<WorkflowJobQuery>(
+                            WorkflowJobQuery.UPDATE_WORKFLOW_PARENT_MODIFIED, wfJob));
+                    updateList.add(new UpdateEntry<CoordActionQuery>(
+                            CoordActionQuery.UPDATE_COORD_ACTION_FOR_START, coordAction));
                     try {
-                        jpaService.execute(new BulkUpdateInsertForCoordActionStartJPAExecutor(updateList, insertList));
+                        executor.executeBatchInsertUpdateDelete(insertList, updateList, null);
                         if (EventHandlerService.isEnabled()) {
                             generateEvent(coordAction, user, appName, wfJob.getStartTime());
                         }
@@ -234,8 +242,9 @@ public class CoordActionStartXCommand ex
                     coordAction.setErrorMessage(errMsg);
                     coordAction.setErrorCode(errCode);
 
-                    updateList = new ArrayList<JsonBean>();
-                    updateList.add(coordAction);
+                    updateList = new ArrayList<UpdateEntry>();
+                    updateList.add(new UpdateEntry<CoordActionQuery>(
+                                    CoordActionQuery.UPDATE_COORD_ACTION_FOR_START, coordAction));
                     insertList = new ArrayList<JsonBean>();
 
                     SLAEventBean slaEvent = SLADbOperations.createStatusEvent(coordAction.getSlaXml(), coordAction.getId(), Status.FAILED,
@@ -245,7 +254,7 @@ public class CoordActionStartXCommand ex
                     }
                     try {
                         // call JPAExecutor to do the bulk writes
-                        jpaService.execute(new BulkUpdateInsertForCoordActionStartJPAExecutor(updateList, insertList));
+                        BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, updateList, null);
                         if (EventHandlerService.isEnabled()) {
                             generateEvent(coordAction, user, appName, null);
                         }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionTimeOutXCommand.java Sun Sep  8 02:47:39 2013
@@ -25,7 +25,9 @@ import org.apache.oozie.client.Coordinat
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.executor.jpa.CoordActionGetForTimeoutJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 import org.apache.oozie.service.EventHandlerService;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
@@ -58,7 +60,8 @@ public class CoordActionTimeOutXCommand 
             try {
                 queue(new CoordActionNotificationXCommand(actionBean), 100);
                 actionBean.setLastModifiedTime(new Date());
-                jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateStatusJPAExecutor(actionBean));
+                CoordActionQueryExecutor.getInstance().executeUpdate(
+                        CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME, actionBean);
                 if (EventHandlerService.isEnabled()) {
                     generateEvent(actionBean, user, appName, null);
                 }
@@ -116,8 +119,8 @@ public class CoordActionTimeOutXCommand 
     @Override
     protected void verifyPrecondition() throws CommandException, PreconditionException {
         if (actionBean.getStatus() != CoordinatorAction.Status.WAITING) {
-            throw new PreconditionException(ErrorCode.E1100, "The coord action must have status " + CoordinatorAction.Status.WAITING
-                    + " but has status [" + actionBean.getStatus() + "]");
+            throw new PreconditionException(ErrorCode.E1100, "The coord action must have status "
+                    + CoordinatorAction.Status.WAITING + " but has status [" + actionBean.getStatus() + "]");
         }
     }
 }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionUpdateXCommand.java Sun Sep  8 02:47:39 2013
@@ -39,10 +39,13 @@ import org.apache.oozie.client.SLAEvent.
 import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.command.CommandException;
 import org.apache.oozie.command.PreconditionException;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertForCoordActionStatusJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordActionGetForExternalIdJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordinatorJobGetForUserAppnameJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 
 @SuppressWarnings("deprecation")
 public class CoordActionUpdateXCommand extends CoordinatorXCommand<Void> {
@@ -51,7 +54,7 @@ public class CoordActionUpdateXCommand e
     private CoordinatorJobBean coordJob;
     private JPAService jpaService = null;
     private int maxRetries = 1;
-    private List<JsonBean> updateList = new ArrayList<JsonBean>();
+    private List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
     private List<JsonBean> insertList = new ArrayList<JsonBean>();
 
     public CoordActionUpdateXCommand(WorkflowJobBean workflow) {
@@ -98,8 +101,8 @@ public class CoordActionUpdateXCommand e
                 LOG.warn("Unexpected workflow " + workflow.getId() + " STATUS " + workflow.getStatus());
                 // update lastModifiedTime
                 coordAction.setLastModifiedTime(new Date());
-                updateList.add(coordAction);
-                jpaService.execute(new BulkUpdateInsertForCoordActionStatusJPAExecutor(updateList, null));
+                CoordActionQueryExecutor.getInstance().executeUpdate(
+                        CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_MODIFIED_DATE, coordAction);
                 // TODO - Uncomment this when bottom up rerun can change terminal state
                 /* CoordinatorJobBean coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
                 if (!coordJob.isPending()) {
@@ -113,7 +116,8 @@ public class CoordActionUpdateXCommand e
                     + " to " + coordAction.getStatus() + ", pending = " + coordAction.getPending());
 
             coordAction.setLastModifiedTime(new Date());
-            updateList.add(coordAction);
+            updateList.add(new UpdateEntry<CoordActionQuery>(CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME,
+                    coordAction));
             // TODO - Uncomment this when bottom up rerun can change terminal state
             /*CoordinatorJobBean coordJob = jpaService.execute(new CoordJobGetJPAExecutor(coordAction.getJobId()));
             if (!coordJob.isPending()) {
@@ -133,7 +137,7 @@ public class CoordActionUpdateXCommand e
                 queue(new CoordActionReadyXCommand(coordAction.getJobId()));
             }
 
-            jpaService.execute(new BulkUpdateInsertForCoordActionStatusJPAExecutor(updateList, insertList));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, updateList, null);
             if (EventHandlerService.isEnabled()) {
                 generateEvent(coordAction, coordJob.getUser(), coordJob.getAppName(), workflow.getStartTime());
             }
@@ -227,10 +231,10 @@ public class CoordActionUpdateXCommand e
         // if coord action is RUNNING and pending false and workflow is RUNNING, this doesn't need to be updated.
         if (workflow.getStatus() == WorkflowJob.Status.RUNNING
                 && coordAction.getStatus() == CoordinatorAction.Status.RUNNING && !coordAction.isPending()) {
-            // update lastModifiedTime
-            coordAction.setLastModifiedTime(new Date());
             try {
-                jpaService.execute(new org.apache.oozie.executor.jpa.CoordActionUpdateStatusJPAExecutor(coordAction));
+                CoordActionQueryExecutor.getInstance().executeUpdate(
+                        CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME,
+                        coordAction);
             }
             catch (JPAExecutorException je) {
                 throw new CommandException(je);

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java?rev=1520829&r1=1520828&r2=1520829&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/command/coord/CoordActionsKillXCommand.java Sun Sep  8 02:47:39 2013
@@ -32,8 +32,11 @@ import org.apache.oozie.command.KillTran
 import org.apache.oozie.command.PreconditionException;
 import org.apache.oozie.command.wf.KillXCommand;
 import org.apache.oozie.coord.CoordUtils;
-import org.apache.oozie.executor.jpa.BulkUpdateInsertForCoordActionStatusJPAExecutor;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.EventHandlerService;
 import org.apache.oozie.service.JPAService;
@@ -123,7 +126,7 @@ public class CoordActionsKillXCommand ex
             else {
                 coordAction.setPending(0);
             }
-            updateList.add(coordAction);
+            updateList.add(new UpdateEntry(CoordActionQuery.UPDATE_COORD_ACTION_STATUS_PENDING_TIME, coordAction));
             if (EventHandlerService.isEnabled()) {
                 CoordinatorXCommand.generateEvent(coordAction, coordJob.getUser(), coordJob.getAppName(),
                         coordAction.getCreatedTime());
@@ -142,7 +145,7 @@ public class CoordActionsKillXCommand ex
     @Override
     public void performWrites() throws CommandException {
         try {
-            jpaService.execute(new BulkUpdateInsertForCoordActionStatusJPAExecutor(updateList, null));
+            BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
         }
         catch (JPAExecutorException e) {
             throw new CommandException(e);
@@ -152,7 +155,7 @@ public class CoordActionsKillXCommand ex
     @Override
     public void updateJob() throws CommandException {
         coordJob.setPending();
-        updateList.add(coordJob);
+        updateList.add(new UpdateEntry(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING, coordJob));
     }
 
     @Override