You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oozie.apache.org by ry...@apache.org on 2013/09/07 02:25:33 UTC

svn commit: r1520716 [3/5] - 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...

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForInputCheckJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,75 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Updates the action status, pending status, last modified time, actionXml and missingDependencies of CoordinatorAction and persists it.
- * It executes SQL update query and return type is Void.
- */
-public class CoordActionUpdateForInputCheckJPAExecutor implements JPAExecutor<Void> {
-
-    private CoordinatorActionBean coordAction = null;
-
-    public CoordActionUpdateForInputCheckJPAExecutor(CoordinatorActionBean coordAction) {
-        ParamChecker.notNull(coordAction, "coordAction");
-        this.coordAction = coordAction;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_FOR_INPUTCHECK");
-            q.setParameter("id", coordAction.getId());
-            q.setParameter("status", coordAction.getStatus().toString());
-            q.setParameter("lastModifiedTime", new Date());
-            q.setParameter("actionXml", coordAction.getActionXml());
-            q.setParameter("missingDependencies", coordAction.getMissingDependencies());
-            q.executeUpdate();
-            // Since the return type is Void, we have to return null
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "CoordActionUpdateForInputCheckJPAExecutor";
-    }
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateForModifiedTimeJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,72 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Updates the last modified time of CoordinatorAction and persists it.
- * It executes SQL update query and return type is Void.
- */
-public class CoordActionUpdateForModifiedTimeJPAExecutor implements JPAExecutor<Void> {
-
-    private CoordinatorActionBean coordAction = null;
-
-    public CoordActionUpdateForModifiedTimeJPAExecutor(CoordinatorActionBean coordAction) {
-        ParamChecker.notNull(coordAction, "coordAction");
-        this.coordAction = coordAction;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_FOR_MODIFIED_DATE");
-            q.setParameter("id", coordAction.getId());
-            q.setParameter("lastModifiedTime", new Date());
-            q.executeUpdate();
-            // Since the return type is Void, we have to return null
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "CoordActionUpdateForModifiedTimeJPAExecutor";
-    }
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,67 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-
-import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Update the CoordinatorAction into a Bean and persist it
- */
-public class CoordActionUpdateJPAExecutor implements JPAExecutor<Void> {
-
-    private CoordinatorActionBean coordAction = null;
-
-    /**
-     * Create the object for CoordActionUpdateJPAExecutor to update the CoordinatorAction into a Bean and persist it
-     * 
-     * @param coordAction
-     */
-    public CoordActionUpdateJPAExecutor(CoordinatorActionBean coordAction) {
-        ParamChecker.notNull(coordAction, "coordAction");
-        this.coordAction = coordAction;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            coordAction.setLastModifiedTime(new Date());
-            em.merge(coordAction);
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "CoordActionUpdateJPAExecutor";
-    }
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdatePushInputCheckJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,76 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Updates the action status, pending status, last modified time, push
- * missingDependencies of CoordinatorAction and persists it. It executes SQL
- * update query and return type is Void.
- */
-public class CoordActionUpdatePushInputCheckJPAExecutor implements JPAExecutor<Void> {
-
-    private CoordinatorActionBean coordAction = null;
-
-    public CoordActionUpdatePushInputCheckJPAExecutor(CoordinatorActionBean coordAction) {
-        ParamChecker.notNull(coordAction, "coordAction");
-        this.coordAction = coordAction;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK");
-            q.setParameter("id", coordAction.getId());
-            q.setParameter("status", coordAction.getStatus().toString());
-            q.setParameter("lastModifiedTime", new Date());
-            q.setParameter("actionXml", coordAction.getActionXml());
-            q.setParameter("pushMissingDependencies", coordAction.getPushMissingDependencies());
-            q.executeUpdate();
-            // Since the return type is Void, we have to return null
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "CoordActionUpdatePushInputCheckJPAExecutor";
-    }
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordActionUpdateStatusJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,74 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.CoordinatorActionBean;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Updates the action status, pending status and last modified time of CoordinatorAction and persists it.
- * It executes SQL update query and return type is Void.
- */
-public class CoordActionUpdateStatusJPAExecutor implements JPAExecutor<Void> {
-
-    private CoordinatorActionBean coordAction = null;
-
-    public CoordActionUpdateStatusJPAExecutor(CoordinatorActionBean coordAction) {
-        ParamChecker.notNull(coordAction, "coordAction");
-        this.coordAction = coordAction;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            Query q = em.createNamedQuery("UPDATE_COORD_ACTION_STATUS_PENDING_TIME");
-            q.setParameter("id", coordAction.getId());
-            q.setParameter("status", coordAction.getStatus().toString());
-            q.setParameter("pending", coordAction.getPending());
-            q.setParameter("lastModifiedTime", new Date());
-            q.executeUpdate();
-            // Since the return type is Void, we have to return null
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "CoordActionUpdateStatusJPAExecutor";
-    }
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/CoordJobUpdateJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,67 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import javax.persistence.EntityManager;
-import org.apache.oozie.CoordinatorJobBean;
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Update the CoordinatorJob into a Bean and persist it.
- */
-public class CoordJobUpdateJPAExecutor implements JPAExecutor<Void> {
-
-    private CoordinatorJobBean coordJob = null;
-
-    /**
-     * @param coordJob
-     */
-    public CoordJobUpdateJPAExecutor(CoordinatorJobBean coordJob) {
-        ParamChecker.notNull(coordJob, "CoordinatorJobBean");
-        this.coordJob = coordJob;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            em.merge(coordJob);
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "CoordinatorUpdateJobJPAExecutor";
-    }
-
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionGetJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -94,7 +94,7 @@ public class WorkflowActionGetJPAExecuto
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.getPending() == true) {
+            if (a.isPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionSubsetGetJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -109,7 +109,7 @@ public class WorkflowActionSubsetGetJPAE
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.getPending() == true) {
+            if (a.isPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionUpdateJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import javax.persistence.EntityManager;
-
-import org.apache.oozie.WorkflowActionBean;
-import org.apache.oozie.util.ParamChecker;
-import org.apache.oozie.ErrorCode;
-
-/**
-* Persist the WorkflowAction bean.
-*/
-public class WorkflowActionUpdateJPAExecutor implements JPAExecutor<String> {
-
-    private WorkflowActionBean wfAction = null;
-
-    public WorkflowActionUpdateJPAExecutor(WorkflowActionBean wfAction) {
-        ParamChecker.notNull(wfAction, "wfAction");
-        this.wfAction = wfAction;
-    }
-
-    @Override
-    public String getName() {
-        return "WorkflowActionUpdateJPAExecutor";
-    }
-
-    @Override
-    public String execute(EntityManager em) throws JPAExecutorException {
-
-        try {
-            em.merge(wfAction);
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsGetForJobJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -93,7 +93,7 @@ public class WorkflowActionsGetForJobJPA
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.getPending() == true) {
+            if (a.isPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowActionsRunningGetJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -98,7 +98,7 @@ public class WorkflowActionsRunningGetJP
             action.setExecutionPath(bean.getExecutionPath());
             action.setLastCheckTime(bean.getLastCheckTime());
             action.setLogToken(bean.getLogToken());
-            if (bean.getPending() == true) {
+            if (bean.isPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(bean.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobGetActionsJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -87,7 +87,7 @@ public class WorkflowJobGetActionsJPAExe
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.getPending() == true) {
+            if (a.isPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/WorkflowJobUpdateJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,63 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-
-import org.apache.oozie.WorkflowJobBean;
-import org.apache.oozie.util.ParamChecker;
-import org.apache.oozie.ErrorCode;
-
-/**
-* Persist the WorkflowJob bean.
-*/
-public class WorkflowJobUpdateJPAExecutor implements JPAExecutor<Void> {
-
-    private WorkflowJobBean wfJob = null;
-
-    public WorkflowJobUpdateJPAExecutor(WorkflowJobBean wfJob) {
-        ParamChecker.notNull(wfJob, "wfJob");
-        this.wfJob = wfJob;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "WorkflowJobUpdateJPAExecutor";
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            wfJob.setLastModifiedTime(new Date());
-            em.merge(wfJob);
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLACalculationInsertUpdateJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,105 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa.sla;
-
-import java.util.Collection;
-
-import javax.persistence.EntityManager;
-
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.FaultInjection;
-import org.apache.oozie.client.rest.JsonBean;
-import org.apache.oozie.executor.jpa.JPAExecutor;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Persist the SLA beans to tables SLA_CALCULATOR and SLA_SUMMARY.
- */
-public class SLACalculationInsertUpdateJPAExecutor implements JPAExecutor<String> {
-
-    private Collection<JsonBean> insertList;
-    private Collection<JsonBean> updateList;
-
-    public SLACalculationInsertUpdateJPAExecutor(Collection<JsonBean> insertList, Collection<JsonBean> updateList) {
-        setInsertList(insertList);
-        setUpdateList(updateList);
-    }
-
-    public SLACalculationInsertUpdateJPAExecutor() {
-    }
-
-    /**
-     * Sets the list of beans to insert
-     *
-     * @param insert
-     */
-    public void setInsertList(Collection<JsonBean> insertList) {
-        this.insertList = insertList;
-    }
-
-    /**
-     * Sets the list of beans to update
-     *
-     * @param update
-     */
-    public void setUpdateList(Collection<JsonBean> updateList) {
-        this.updateList = updateList;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "SLACalculationInsertUpdateJPAExecutor";
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public String execute(EntityManager em) throws JPAExecutorException {
-        try {
-            if (insertList != null) {
-                for (JsonBean entity : insertList) {
-                    ParamChecker.notNull(entity, "JsonBean");
-                    em.persist(entity);
-                }
-            }
-            // Only used by test cases to check for rollback of transaction
-            FaultInjection.activate("org.apache.oozie.command.SkipCommitFaultInjection");
-            if (updateList != null) {
-                for (JsonBean entity : updateList) {
-                    ParamChecker.notNull(entity, "JsonBean");
-                    em.merge(entity);
-                }
-            }
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/executor/jpa/sla/SLASummaryUpdateForSLAStatusActualTimesJPAExecutor.java Sat Sep  7 00:25:30 2013
@@ -1,80 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.oozie.executor.jpa.sla;
-
-import java.util.Date;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-
-import org.apache.oozie.ErrorCode;
-import org.apache.oozie.executor.jpa.JPAExecutor;
-import org.apache.oozie.executor.jpa.JPAExecutorException;
-import org.apache.oozie.sla.SLASummaryBean;
-import org.apache.oozie.util.ParamChecker;
-
-/**
- * Update the slaStatus, eventStatus, eventProcessed, jobStatus, actualStart,
- * actualEnd, actualDuration and lastModifiedTime of SLAsummaryBean
- */
-public class SLASummaryUpdateForSLAStatusActualTimesJPAExecutor implements JPAExecutor<Void> {
-
-    private SLASummaryBean slaSummaryBean = null;
-
-    public SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(SLASummaryBean slaSummaryBean) {
-        ParamChecker.notNull(slaSummaryBean, "slaSummaryBean");
-        this.slaSummaryBean = slaSummaryBean;
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#execute(javax.persistence.
-     * EntityManager)
-     */
-    @Override
-    public Void execute(EntityManager em) throws JPAExecutorException {
-        try {
-            Query q = em.createNamedQuery("UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES");
-            q.setParameter("jobId", slaSummaryBean.getId());
-            q.setParameter("slaStatus", slaSummaryBean.getSLAStatusString());
-            q.setParameter("lastModifiedTS", new Date());
-            q.setParameter("eventStatus", slaSummaryBean.getEventStatusString());
-            q.setParameter("jobStatus", slaSummaryBean.getJobStatus());
-            q.setParameter("eventProcessed", slaSummaryBean.getEventProcessed());
-            q.setParameter("actualStartTS", slaSummaryBean.getActualStart());
-            q.setParameter("actualEndTS", slaSummaryBean.getActualEnd());
-            q.setParameter("actualDuration", slaSummaryBean.getActualDuration());
-            q.executeUpdate();
-            return null;
-        }
-        catch (Exception e) {
-            throw new JPAExecutorException(ErrorCode.E0603, e.getMessage(), e);
-        }
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see org.apache.oozie.executor.jpa.JPAExecutor#getName()
-     */
-    @Override
-    public String getName() {
-        return "SLASummaryUpdateForSLAStatusActualTimesJPAExecutor";
-    }
-}

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/CoordMaterializeTriggerService.java Sat Sep  7 00:25:30 2013
@@ -25,8 +25,7 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.oozie.CoordinatorJobBean;
 import org.apache.oozie.command.coord.CoordMaterializeTransitionXCommand;
 import org.apache.oozie.executor.jpa.CoordActionsActiveCountJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobGetRunningActionsCountJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordJobsToBeMaterializedJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.util.XCallable;
@@ -133,7 +132,9 @@ public class CoordMaterializeTriggerServ
                                 + " MatThrottle : " + coordJob.getMatThrottling());
                         // update lastModifiedTime so next time others might have higher chance to get pick up
                         coordJob.setLastModifiedTime(new Date());
-                        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
+                        CoordJobQueryExecutor.getInstance().executeUpdate(
+                                CoordJobQueryExecutor.CoordJobQuery.UPDATE_COORD_JOB_LAST_MODIFIED_TIME,
+                                coordJob);
                         if (numWaitingActions >= coordJob.getMatThrottling()) {
                             LOG.info("info for JobID [" + coordJob.getId() + " already waiting "
                                     + numWaitingActions + " actions. MatThrottle is : " + coordJob.getMatThrottling());

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/JPAService.java Sat Sep  7 00:25:30 2013
@@ -19,12 +19,16 @@ package org.apache.oozie.service;
 
 import java.io.IOException;
 import java.text.MessageFormat;
+import java.util.Collection;
+import java.util.List;
 import java.util.Properties;
 
 import javax.persistence.EntityManager;
 import javax.persistence.EntityManagerFactory;
+import javax.persistence.NoResultException;
 import javax.persistence.Persistence;
 import javax.persistence.PersistenceException;
+import javax.persistence.Query;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.oozie.BundleActionBean;
@@ -36,6 +40,7 @@ import org.apache.oozie.FaultInjection;
 import org.apache.oozie.SLAEventBean;
 import org.apache.oozie.WorkflowActionBean;
 import org.apache.oozie.WorkflowJobBean;
+import org.apache.oozie.client.rest.JsonBean;
 import org.apache.oozie.client.rest.JsonSLAEvent;
 import org.apache.oozie.executor.jpa.JPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
@@ -52,7 +57,7 @@ import org.apache.openjpa.persistence.Op
  */
 @SuppressWarnings("deprecation")
 public class JPAService implements Service, Instrumentable {
-    private static final String INSTRUMENTATION_GROUP = "jpa";
+    private static final String INSTRUMENTATION_GROUP_JPA = "jpa";
 
     public static final String CONF_DB_SCHEMA = "oozie.db.schema.name";
 
@@ -200,7 +205,7 @@ public class JPAService implements Servi
         try {
             LOG.trace("Executing JPAExecutor [{0}]", executor.getName());
             if (instr != null) {
-                instr.incr(INSTRUMENTATION_GROUP, executor.getName(), 1);
+                instr.incr(INSTRUMENTATION_GROUP_JPA, executor.getName(), 1);
             }
             cron.start();
             em.getTransaction().begin();
@@ -220,7 +225,7 @@ public class JPAService implements Servi
         finally {
             cron.stop();
             if (instr != null) {
-                instr.addCron(INSTRUMENTATION_GROUP, executor.getName(), cron);
+                instr.addCron(INSTRUMENTATION_GROUP_JPA, executor.getName(), cron);
             }
             try {
                 if (em.getTransaction().isActive()) {
@@ -248,11 +253,225 @@ public class JPAService implements Servi
     }
 
     /**
+     * Execute an UPDATE query
+     * @param namedQueryName the name of query to be executed
+     * @param query query instance to be executed
+     * @param em Entity Manager
+     * @return Integer that query returns, which corresponds to the number of rows updated
+     * @throws JPAExecutorException
+     */
+    public int executeUpdate(String namedQueryName, Query query, EntityManager em) throws JPAExecutorException {
+        Instrumentation.Cron cron = new Instrumentation.Cron();
+        try {
+
+            LOG.trace("Executing Update/Delete Query [{0}]", namedQueryName);
+            if (instr != null) {
+                instr.incr(INSTRUMENTATION_GROUP_JPA, namedQueryName, 1);
+            }
+            cron.start();
+            em.getTransaction().begin();
+            int ret = query.executeUpdate();
+            if (em.getTransaction().isActive()) {
+                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
+                    throw new RuntimeException("Skipping Commit for Failover Testing");
+                }
+                em.getTransaction().commit();
+            }
+            return ret;
+        }
+        catch (PersistenceException e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e);
+        }
+        finally {
+            processFinally(em, cron, namedQueryName);
+        }
+    }
+
+    public static class QueryEntry<E extends Enum<E>> {
+        E namedQuery;
+        Query query;
+
+        public QueryEntry(E namedQuery, Query query) {
+            this.namedQuery = namedQuery;
+            this.query = query;
+        }
+
+        public Query getQuery() {
+            return this.query;
+        }
+
+        public E getQueryName() {
+            return this.namedQuery;
+        }
+    }
+
+    private void processFinally(EntityManager em, Instrumentation.Cron cron, String name){
+        cron.stop();
+        if (instr != null) {
+            instr.addCron(INSTRUMENTATION_GROUP_JPA, name, cron);
+        }
+        try {
+            if (em.getTransaction().isActive()) {
+                LOG.warn("[{0}] ended with an active transaction, rolling back", name);
+                em.getTransaction().rollback();
+            }
+        }
+        catch (Exception ex) {
+            LOG.warn("Could not check/rollback transaction after [{0}], {1}", name,
+                    ex.getMessage(), ex);
+        }
+        try {
+            if (em.isOpen()) {
+                em.close();
+            }
+            else {
+                LOG.warn("[{0}] closed the EntityManager, it should not!", name);
+            }
+        }
+        catch (Exception ex) {
+            LOG.warn("Could not close EntityManager after [{0}], {1}", name, ex.getMessage(), ex);
+        }
+    }
+
+    /**
+     * Execute multiple update/insert queries in one transaction
+     * @param insertBeans list of beans to be inserted
+     * @param updateQueryList list of update queries
+     * @param deleteBeans list of beans to be deleted
+     * @param em Entity Manager
+     * @throws JPAExecutorException
+     */
+    public void executeBatchInsertUpdateDelete(Collection<JsonBean> insertBeans, List<QueryEntry> updateQueryList,
+            Collection<JsonBean> deleteBeans, EntityManager em) throws JPAExecutorException {
+        Instrumentation.Cron cron = new Instrumentation.Cron();
+        try {
+
+            LOG.trace("Executing Queries in Batch");
+            cron.start();
+            em.getTransaction().begin();
+            if (updateQueryList != null && updateQueryList.size() > 0) {
+                for (QueryEntry q : updateQueryList) {
+                    if (instr != null) {
+                        instr.incr(INSTRUMENTATION_GROUP_JPA, q.getQueryName().name(), 1);
+                    }
+                    q.getQuery().executeUpdate();
+                }
+            }
+            if (insertBeans != null && insertBeans.size() > 0) {
+                for (JsonBean bean : insertBeans) {
+                    em.persist(bean);
+                }
+            }
+            if (deleteBeans != null && deleteBeans.size() > 0) {
+                for (JsonBean bean : deleteBeans) {
+                    em.remove(em.merge(bean));
+                }
+            }
+            if (em.getTransaction().isActive()) {
+                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
+                    throw new RuntimeException("Skipping Commit for Failover Testing");
+                }
+                em.getTransaction().commit();
+            }
+        }
+        catch (PersistenceException e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e);
+        }
+        finally {
+            processFinally(em, cron, "batchqueryexecutor");
+        }
+    }
+
+    /**
+     * Execute a SELECT query
+     * @param namedQueryName the name of query to be executed
+     * @param query query instance to be executed
+     * @param em Entity Manager
+     * @return object that matches the query
+     * @throws JPAExecutorException
+     */
+    public Object executeGet(String namedQueryName, Query query, EntityManager em) throws JPAExecutorException {
+        Instrumentation.Cron cron = new Instrumentation.Cron();
+        try {
+
+            LOG.trace("Executing Select Query to Get a Single row  [{0}]", namedQueryName);
+            if (instr != null) {
+                instr.incr(INSTRUMENTATION_GROUP_JPA, namedQueryName, 1);
+            }
+
+            cron.start();
+            em.getTransaction().begin();
+            Object obj = null;
+            try {
+                obj = query.getSingleResult();
+            }
+            catch (NoResultException e) {
+                // return null when no matched result
+            }
+            if (em.getTransaction().isActive()) {
+                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
+                    throw new RuntimeException("Skipping Commit for Failover Testing");
+                }
+                em.getTransaction().commit();
+            }
+            return obj;
+        }
+        catch (PersistenceException e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e);
+        }
+        finally {
+            processFinally(em, cron, namedQueryName);
+        }
+    }
+
+    /**
+     * Execute a SELECT query to get list of results
+     * @param namedQueryName the name of query to be executed
+     * @param query query instance to be executed
+     * @param em Entity Manager
+     * @return list containing results that match the query
+     * @throws JPAExecutorException
+     */
+    public List executeGetList(String namedQueryName, Query query, EntityManager em) throws JPAExecutorException {
+        Instrumentation.Cron cron = new Instrumentation.Cron();
+        try {
+
+            LOG.trace("Executing Select Query to Get Multiple Rows [{0}]", namedQueryName);
+            if (instr != null) {
+                instr.incr(INSTRUMENTATION_GROUP_JPA, namedQueryName, 1);
+            }
+
+            cron.start();
+            em.getTransaction().begin();
+            List resultList = null;
+            try {
+                resultList = query.getResultList();
+            }
+            catch (NoResultException e) {
+                // return null when no matched result
+            }
+            if (em.getTransaction().isActive()) {
+                if (FaultInjection.isActive("org.apache.oozie.command.SkipCommitFaultInjection")) {
+                    throw new RuntimeException("Skipping Commit for Failover Testing");
+                }
+                em.getTransaction().commit();
+            }
+            return resultList;
+        }
+        catch (PersistenceException e) {
+            throw new JPAExecutorException(ErrorCode.E0603, e);
+        }
+        finally {
+            processFinally(em, cron, namedQueryName);
+        }
+    }
+
+    /**
      * Return an EntityManager. Used by the StoreService. Once the StoreService is removed this method must be removed.
      *
      * @return an entity manager
      */
-    EntityManager getEntityManager() {
+    public EntityManager getEntityManager() {
         return factory.createEntityManager();
     }
 

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/service/StatusTransitService.java Sat Sep  7 00:25:30 2013
@@ -39,13 +39,15 @@ import org.apache.oozie.command.bundle.B
 import org.apache.oozie.executor.jpa.BundleActionsGetByLastModifiedTimeJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleActionsGetStatusPendingJPAExecutor;
 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.BundleJobsGetRunningOrPendingJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionsGetByLastModifiedTimeJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetActionsStatusJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetPendingActionsCountJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
 import org.apache.oozie.executor.jpa.CoordJobsGetPendingJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.util.DateUtils;
@@ -637,7 +639,7 @@ public class StatusTransitService implem
                 bundleJob.resetPending();
                 LOG.info("Bundle job [" + jobId + "] Pending set to FALSE");
             }
-            jpaService.execute(new BundleJobUpdateJPAExecutor(bundleJob));
+            BundleJobQueryExecutor.getInstance().executeUpdate(BundleJobQuery.UPDATE_BUNDLE_JOB_STATUS_PENDING_MODTIME, bundleJob);
         }
 
         private void updateCoordJob(boolean isPending, CoordinatorJobBean coordJob, Job.Status coordStatus)
@@ -662,7 +664,7 @@ public class StatusTransitService implem
             if (coordJob.getStatus() != prevStatus || isPendingStateChanged) {
                 LOG.debug("Updating coord job " + coordJob.getId());
                 coordJob.setLastModifiedTime(new Date());
-                jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
+                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_MODTIME, coordJob);
             }
             // update bundle action only when status changes in coord job
             if (coordJob.getBundleId() != null) {
@@ -687,7 +689,7 @@ public class StatusTransitService implem
             }
             boolean hasChange = prevPending != coordJob.isPending();
             if (saveToDB && hasChange) {
-                jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
+                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_PENDING_MODTIME, coordJob);
             }
             return hasChange;
 

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLACalculatorMemory.java Sat Sep  7 00:25:30 2013
@@ -40,16 +40,18 @@ import org.apache.oozie.client.event.Job
 import org.apache.oozie.client.event.SLAEvent.EventStatus;
 import org.apache.oozie.client.event.SLAEvent.SLAStatus;
 import org.apache.oozie.client.rest.JsonBean;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor;
 import org.apache.oozie.executor.jpa.CoordActionGetForSLAJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.SLARegistrationQueryExecutor.SLARegQuery;
+import org.apache.oozie.executor.jpa.SLASummaryQueryExecutor;
 import org.apache.oozie.executor.jpa.WorkflowActionGetForSLAJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobGetForSLAJPAExecutor;
-
-import org.apache.oozie.executor.jpa.sla.SLACalculationInsertUpdateJPAExecutor;
 import org.apache.oozie.executor.jpa.sla.SLARegistrationGetOnRestartJPAExecutor;
 import org.apache.oozie.executor.jpa.sla.SLASummaryGetJPAExecutor;
 import org.apache.oozie.executor.jpa.sla.SLASummaryGetRecordsOnRestartJPAExecutor;
-import org.apache.oozie.executor.jpa.sla.SLASummaryUpdateForSLAStatusActualTimesJPAExecutor;
+import org.apache.oozie.executor.jpa.SLASummaryQueryExecutor.SLASummaryQuery;
+import org.apache.oozie.executor.jpa.BatchQueryExecutor.UpdateEntry;
 import org.apache.oozie.service.EventHandlerService;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.ServiceException;
@@ -112,7 +114,9 @@ public class SLACalculatorMemory impleme
                             break;
                     }
                     if (isJobModified) {
-                        jpaService.execute(new SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(summaryBean));
+                        summaryBean.setLastModifiedTime(new Date());
+                        SLASummaryQueryExecutor.getInstance().executeUpdate(
+                                SLASummaryQuery.UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES, summaryBean);
                     }
                 }
                 catch (Exception e) {
@@ -352,7 +356,9 @@ public class SLACalculatorMemory impleme
                 slaSummaryBean.setActualStart(slaCalc.getActualStart());
                 slaSummaryBean.setActualDuration(slaCalc.getActualDuration());
                 slaSummaryBean.setJobStatus(slaCalc.getJobStatus());
-                jpaService.execute(new SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(slaSummaryBean));
+                slaSummaryBean.setLastModifiedTime(new Date());
+                SLASummaryQueryExecutor.getInstance().executeUpdate(
+                        SLASummaryQuery.UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES, slaSummaryBean);
                 if (eventProc == 7) {
                     historySet.add(jobId);
                     slaMap.remove(jobId);
@@ -397,7 +403,7 @@ public class SLACalculatorMemory impleme
                 List<JsonBean> insertList = new ArrayList<JsonBean>();
                 insertList.add(reg);
                 insertList.add(new SLASummaryBean(slaCalc));
-                jpaService.execute(new SLACalculationInsertUpdateJPAExecutor(insertList, null));
+                BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(insertList, null, null);
                 LOG.trace("SLA Registration Event - Job:" + jobId);
                 return true;
             }
@@ -442,10 +448,11 @@ public class SLACalculatorMemory impleme
                 slaCalc.setSLAStatus(SLAStatus.NOT_STARTED);
                 slaCalc.setJobStatus(getJobStatus(reg.getAppType()));
                 slaMap.put(jobId, slaCalc);
-                List<JsonBean> updateList = new ArrayList<JsonBean>();
-                updateList.add(reg);
-                updateList.add(new SLASummaryBean(slaCalc));
-                jpaService.execute(new SLACalculationInsertUpdateJPAExecutor(null, updateList));
+                List<UpdateEntry> updateList = new ArrayList<UpdateEntry>();
+                updateList.add(new UpdateEntry<SLARegQuery>(SLARegQuery.UPDATE_SLA_REG_ALL, reg));
+                updateList.add(new UpdateEntry<SLASummaryQuery>(SLASummaryQuery.UPDATE_SLA_SUMMARY_ALL,
+                        new SLASummaryBean(slaCalc)));
+                BatchQueryExecutor.getInstance().executeBatchInsertUpdateDelete(null, updateList, null);
                 LOG.trace("SLA Registration Event - Job:" + jobId);
                 return true;
             }
@@ -524,7 +531,9 @@ public class SLACalculatorMemory impleme
         }
 
         if (hasSla) {
-            jpaService.execute(new SLASummaryUpdateForSLAStatusActualTimesJPAExecutor(slaInfo));
+            slaInfo.setLastModifiedTime(new Date());
+            SLASummaryQueryExecutor.getInstance().executeUpdate(
+                    SLASummaryQuery.UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES, slaInfo);
         }
         return hasSla;
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLARegistrationBean.java Sat Sep  7 00:25:30 2013
@@ -17,6 +17,7 @@
  */
 package org.apache.oozie.sla;
 
+import java.sql.Timestamp;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
@@ -46,6 +47,8 @@ import org.json.simple.JSONObject;
 @Table(name = "SLA_REGISTRATION")
 @NamedQueries({
 
+ @NamedQuery(name = "UPDATE_SLA_REG_ALL", query = "update SLARegistrationBean w set w.jobId = :jobId, w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration, w.slaConfig = :slaConfig, w.notificationMsg = :notificationMsg, w.upstreamApps = :upstreamApps, w.appType = :appType, w.appName = :appName, w.user = :user, w.parentId = :parentId, w.jobData = :jobData where w.jobId = :jobId"),
+
  @NamedQuery(name = "GET_SLA_REG_ON_RESTART", query = "select w.notificationMsg, w.upstreamApps, w.slaConfig, w.jobData from SLARegistrationBean w where w.jobId = :id"),
 
  @NamedQuery(name = "GET_SLA_REG_ALL", query = "select OBJECT(w) from SLARegistrationBean w where w.jobId = :id") })
@@ -160,6 +163,10 @@ public class SLARegistrationBean impleme
         return DateUtils.toDate(nominalTimeTS);
     }
 
+    public Timestamp getNominalTimestamp() {
+        return this.nominalTimeTS;
+    }
+
     public void setNominalTime(Date nominalTime) {
         this.nominalTimeTS = DateUtils.convertDateToTimestamp(nominalTime);
     }
@@ -168,6 +175,10 @@ public class SLARegistrationBean impleme
         return DateUtils.toDate(expectedStartTS);
     }
 
+    public Timestamp getExpectedStartTimestamp() {
+        return this.expectedStartTS;
+    }
+
     public void setExpectedStart(Date expectedStart) {
         this.expectedStartTS = DateUtils.convertDateToTimestamp(expectedStart);
     }
@@ -176,6 +187,10 @@ public class SLARegistrationBean impleme
         return DateUtils.toDate(expectedEndTS);
     }
 
+    public Timestamp getExpectedEndTimestamp() {
+        return this.expectedEndTS;
+    }
+
     public void setExpectedEnd(Date expectedEnd) {
         this.expectedEndTS = DateUtils.convertDateToTimestamp(expectedEnd);
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/sla/SLASummaryBean.java Sat Sep  7 00:25:30 2013
@@ -47,6 +47,8 @@ import org.json.simple.JSONObject;
 
  @NamedQuery(name = "UPDATE_SLA_SUMMARY_FOR_STATUS_ACTUAL_TIMES", query = "update SLASummaryBean w set w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.eventProcessed = :eventProcessed, w.jobStatus = :jobStatus, w.lastModifiedTS = :lastModifiedTS, w.actualStartTS = :actualStartTS, w.actualEndTS = :actualEndTS, w.actualDuration = :actualDuration where w.jobId = :jobId"),
 
+ @NamedQuery(name = "UPDATE_SLA_SUMMARY_ALL", query = "update SLASummaryBean w set w.jobId = :jobId, w.appName = :appName, w.appType = :appType, w.nominalTimeTS = :nominalTime, w.expectedStartTS = :expectedStartTime, w.expectedEndTS = :expectedEndTime, w.expectedDuration = :expectedDuration, w.jobStatus = :jobStatus, w.slaStatus = :slaStatus, w.eventStatus = :eventStatus, w.lastModifiedTS = :lastModTime, w.user = :user, w.parentId = :parentId, w.eventProcessed = :eventProcessed, w.actualDuration = :actualDuration, w.actualEndTS = :actualEndTS, w.actualStartTS = :actualStartTS where w.jobId = :jobId"),
+
  @NamedQuery(name = "GET_SLA_SUMMARY", query = "select OBJECT(w) from SLASummaryBean w where w.jobId = :id"),
 
  @NamedQuery(name = "GET_SLA_SUMMARY_RECORDS_RESTART", query = "select OBJECT(w) from SLASummaryBean w where w.eventProcessed <= 7 AND w.lastModifiedTS >= :lastModifiedTime") })
@@ -174,6 +176,10 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(nominalTimeTS);
     }
 
+    public Timestamp getNominalTimestamp() {
+        return this.nominalTimeTS;
+    }
+
     public void setNominalTime(Date nominalTime) {
         this.nominalTimeTS = DateUtils.convertDateToTimestamp(nominalTime);
     }
@@ -183,6 +189,10 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(expectedStartTS);
     }
 
+    public Timestamp getExpectedStartTimestamp() {
+        return this.expectedStartTS;
+    }
+
     public void setExpectedStart(Date expectedStart) {
         this.expectedStartTS = DateUtils.convertDateToTimestamp(expectedStart);
     }
@@ -191,6 +201,9 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(expectedEndTS);
     }
 
+    public Timestamp getExpectedEndTimestamp() {
+        return this.expectedEndTS;
+    }
     public void setExpectedEnd(Date expectedEnd) {
         this.expectedEndTS = DateUtils.convertDateToTimestamp(expectedEnd);
     }
@@ -207,6 +220,10 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(actualStartTS);
     }
 
+    public Timestamp getActualStartTimestamp() {
+        return this.actualStartTS;
+    }
+
     public void setActualStart(Date actualStart) {
         this.actualStartTS = DateUtils.convertDateToTimestamp(actualStart);
     }
@@ -215,6 +232,10 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(actualEndTS);
     }
 
+    public Timestamp getActualEndTimestamp() {
+        return this.actualEndTS;
+    }
+
     public void setActualEnd(Date actualEnd) {
         this.actualEndTS = DateUtils.convertDateToTimestamp(actualEnd);
     }
@@ -295,6 +316,10 @@ public class SLASummaryBean implements J
         return DateUtils.toDate(lastModifiedTS);
     }
 
+    public Timestamp getLastModifiedTimestamp() {
+        return this.lastModifiedTS;
+    }
+
     public void setLastModifiedTime(Date lastModified) {
         this.lastModifiedTS = DateUtils.convertDateToTimestamp(lastModified);
     }

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/store/CoordinatorStore.java Sat Sep  7 00:25:30 2013
@@ -34,6 +34,10 @@ import org.apache.oozie.CoordinatorJobIn
 import org.apache.oozie.ErrorCode;
 import org.apache.oozie.client.Job.Status;
 import org.apache.oozie.client.CoordinatorJob.Timeunit;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.InstrumentationService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.util.DateUtils;
@@ -351,14 +355,12 @@ public class CoordinatorStore extends St
      * @param action Action Bean
      * @throws StoreException if action doesn't exist
      */
-    public void updateCoordinatorAction(final CoordinatorActionBean action) throws StoreException {
+    public void updateCoordinatorAction(final CoordinatorActionBean action) throws StoreException, JPAExecutorException {
         ParamChecker.notNull(action, "CoordinatorActionBean");
         doOperation("updateCoordinatorAction", new Callable<Void>() {
-            public Void call() throws StoreException {
-                Query q = entityManager.createNamedQuery("UPDATE_COORD_ACTION");
-                q.setParameter("id", action.getId());
-                setActionQueryParameters(action, q);
-                q.executeUpdate();
+            public Void call() throws StoreException, JPAExecutorException {
+                CoordActionQueryExecutor.getInstance().executeUpdate(
+                        CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION, action);
                 return null;
             }
         });
@@ -370,17 +372,12 @@ public class CoordinatorStore extends St
      * @param action Action Bean
      * @throws StoreException if action doesn't exist
      */
-    public void updateCoordActionMin(final CoordinatorActionBean action) throws StoreException {
+    public void updateCoordActionMin(final CoordinatorActionBean action) throws StoreException, JPAExecutorException {
         ParamChecker.notNull(action, "CoordinatorActionBean");
         doOperation("updateCoordinatorAction", new Callable<Void>() {
-            public Void call() throws StoreException {
-                Query q = entityManager.createNamedQuery("UPDATE_COORD_ACTION_MIN");
-                q.setParameter("id", action.getId());
-                q.setParameter("missingDependencies", action.getMissingDependencies());
-                q.setParameter("lastModifiedTime", new Date());
-                q.setParameter("status", action.getStatus().toString());
-                q.setParameter("actionXml", action.getActionXml());
-                q.executeUpdate();
+            public Void call() throws StoreException, JPAExecutorException {
+                CoordActionQueryExecutor.getInstance().executeUpdate(
+                        CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK, action);
                 return null;
             }
         });
@@ -395,11 +392,8 @@ public class CoordinatorStore extends St
     public void updateCoordinatorJob(final CoordinatorJobBean job) throws StoreException {
         ParamChecker.notNull(job, "CoordinatorJobBean");
         doOperation("updateJob", new Callable<Void>() {
-            public Void call() throws StoreException {
-                Query q = entityManager.createNamedQuery("UPDATE_COORD_JOB");
-                q.setParameter("id", job.getId());
-                setJobQueryParameters(job, q);
-                q.executeUpdate();
+            public Void call() throws StoreException, JPAExecutorException {
+                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, job);
                 return null;
             }
         });
@@ -408,12 +402,8 @@ public class CoordinatorStore extends St
     public void updateCoordinatorJobStatus(final CoordinatorJobBean job) throws StoreException {
         ParamChecker.notNull(job, "CoordinatorJobBean");
         doOperation("updateJobStatus", new Callable<Void>() {
-            public Void call() throws StoreException {
-                Query q = entityManager.createNamedQuery("UPDATE_COORD_JOB_STATUS");
-                q.setParameter("id", job.getId());
-                q.setParameter("status", job.getStatus().toString());
-                q.setParameter("lastModifiedTime", new Date());
-                q.executeUpdate();
+            public Void call() throws StoreException, JPAExecutorException {
+                CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_STATUS_MODTIME, job);
                 return null;
             }
         });

Modified: oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java (original)
+++ oozie/trunk/core/src/main/java/org/apache/oozie/store/WorkflowStore.java Sat Sep  7 00:25:30 2013
@@ -35,6 +35,9 @@ import org.apache.oozie.WorkflowJobBean;
 import org.apache.oozie.WorkflowsInfo;
 import org.apache.oozie.client.OozieClient;
 import org.apache.oozie.client.WorkflowJob.Status;
+import org.apache.oozie.executor.jpa.JPAExecutorException;
+import org.apache.oozie.executor.jpa.WorkflowActionQueryExecutor;
+import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor;
 import org.apache.oozie.service.InstrumentationService;
 import org.apache.oozie.service.SchemaService;
 import org.apache.oozie.service.Services;
@@ -198,11 +201,9 @@ public class WorkflowStore extends Store
     public void updateWorkflow(final WorkflowJobBean wfBean) throws StoreException {
         ParamChecker.notNull(wfBean, "WorkflowJobBean");
         doOperation("updateWorkflow", new Callable<Void>() {
-            public Void call() throws SQLException, StoreException, WorkflowException {
-                Query q = entityManager.createNamedQuery("UPDATE_WORKFLOW");
-                q.setParameter("id", wfBean.getId());
-                setWFQueryParameters(wfBean, q);
-                q.executeUpdate();
+            public Void call() throws SQLException, StoreException, WorkflowException, JPAExecutorException {
+                WorkflowJobQueryExecutor.getInstance().executeUpdate(
+                        WorkflowJobQueryExecutor.WorkflowJobQuery.UPDATE_WORKFLOW, wfBean);
                 return null;
             }
         });
@@ -274,11 +275,9 @@ public class WorkflowStore extends Store
     public void updateAction(final WorkflowActionBean action) throws StoreException {
         ParamChecker.notNull(action, "WorkflowActionBean");
         doOperation("updateAction", new Callable<Void>() {
-            public Void call() throws SQLException, StoreException, WorkflowException {
-                Query q = entityManager.createNamedQuery("UPDATE_ACTION");
-                q.setParameter("id", action.getId());
-                setActionQueryParameters(action, q);
-                q.executeUpdate();
+            public Void call() throws SQLException, StoreException, WorkflowException, JPAExecutorException {
+                WorkflowActionQueryExecutor.getInstance().executeUpdate(
+                        WorkflowActionQueryExecutor.WorkflowActionQuery.UPDATE_ACTION, action);
                 return null;
             }
         });
@@ -935,7 +934,7 @@ public class WorkflowStore extends Store
             action.setExecutionPath(a.getExecutionPath());
             action.setLastCheckTime(a.getLastCheckTime());
             action.setLogToken(a.getLogToken());
-            if (a.getPending() == true) {
+            if (a.isPending() == true) {
                 action.setPending();
             }
             action.setPendingAge(a.getPendingAge());

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/TestPurgeXCommand.java Sat Sep  7 00:25:30 2013
@@ -18,9 +18,6 @@
 package org.apache.oozie.command;
 
 import java.util.Date;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.fail;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.Path;
@@ -43,12 +40,14 @@ import org.apache.oozie.executor.jpa.Bun
 import org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.executor.jpa.WorkflowActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.WorkflowJobInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.WorkflowJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.WorkflowJobQueryExecutor.WorkflowJobQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.LiteWorkflowStoreService;
 import org.apache.oozie.service.Services;
@@ -1393,16 +1392,16 @@ public class TestPurgeXCommand extends X
         CoordinatorJobBean coordJob1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         CoordinatorJobBean coordJob2 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob2.setAppName("coord2");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob2));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob2);
         CoordinatorJobBean coordJob3 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob3.setAppName("coord3");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob3));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob3);
         CoordinatorJobBean coordJob4 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob4.setAppName("coord4");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob4));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob4);
         CoordinatorJobBean coordJob5 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob5.setAppName("coord5");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob5));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob5);
         WorkflowJobBean wfJob1 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob2 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob3 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
@@ -1803,16 +1802,16 @@ public class TestPurgeXCommand extends X
         CoordinatorJobBean coordJob1 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         CoordinatorJobBean coordJob2 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob2.setAppName("coord2");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob2));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob2);
         CoordinatorJobBean coordJob3 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob3.setAppName("coord3");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob3));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob3);
         CoordinatorJobBean coordJob4 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob4.setAppName("coord4");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob4));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob4);
         CoordinatorJobBean coordJob5 = addRecordToCoordJobTable(CoordinatorJob.Status.SUCCEEDED, false, false);
         coordJob5.setAppName("coord5");
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob5));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB, coordJob5);
         WorkflowJobBean wfJob1 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob2 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
         WorkflowJobBean wfJob3 = addRecordToWfJobTable(WorkflowJob.Status.SUCCEEDED, WorkflowInstance.Status.SUCCEEDED);
@@ -3822,7 +3821,7 @@ public class TestPurgeXCommand extends X
         try {
             JPAService jpaService = Services.get().get(JPAService.class);
             assertNotNull(jpaService);
-            jpaService.execute(new CoordJobUpdateJPAExecutor(job));
+            CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_LAST_MODIFIED_TIME, job);
         }
         catch (JPAExecutorException je) {
             je.printStackTrace();
@@ -3837,7 +3836,7 @@ public class TestPurgeXCommand extends X
         try {
             JPAService jpaService = Services.get().get(JPAService.class);
             assertNotNull(jpaService);
-            jpaService.execute(new WorkflowJobUpdateJPAExecutor(job));
+            WorkflowJobQueryExecutor.getInstance().executeUpdate(WorkflowJobQuery.UPDATE_WORKFLOW_STATUS_INSTANCE_MOD_END, job);
         }
         catch (JPAExecutorException je) {
             je.printStackTrace();

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleChangeXCommand.java Sat Sep  7 00:25:30 2013
@@ -27,7 +27,8 @@ import org.apache.oozie.client.Job;
 import org.apache.oozie.executor.jpa.BundleActionInsertJPAExecutor;
 import org.apache.oozie.executor.jpa.BundleJobGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordJobGetJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordJobUpdateJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordJobQueryExecutor.CoordJobQuery;
 import org.apache.oozie.service.JPAService;
 import org.apache.oozie.service.Services;
 import org.apache.oozie.test.XDataTestCase;
@@ -84,7 +85,7 @@ public class TestBundleChangeXCommand ex
         coordJob.setBundleId(bundleJob.getId());
         final JPAService jpaService = Services.get().get(JPAService.class);
         assertNotNull(jpaService);
-        jpaService.execute(new CoordJobUpdateJPAExecutor(coordJob));
+        CoordJobQueryExecutor.getInstance().executeUpdate(CoordJobQuery.UPDATE_COORD_JOB_BUNDLEID, coordJob);
 
         BundleActionBean bundleAction = new BundleActionBean();
         bundleAction.setBundleActionId("11111");

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/bundle/TestBundleStartXCommand.java Sat Sep  7 00:25:30 2013
@@ -267,6 +267,7 @@ public class TestBundleStartXCommand ext
         assertEquals(Job.Status.FAILED, actions.get(0).getStatus());
         Runnable runnable = new StatusTransitRunnable();
         runnable.run();
+        sleep(2000);
         job = jpaService.execute(bundleJobGetExecutor);
         assertEquals(job.getStatus(), Job.Status.KILLED);
     }

Modified: oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java
URL: http://svn.apache.org/viewvc/oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java?rev=1520716&r1=1520715&r2=1520716&view=diff
==============================================================================
--- oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java (original)
+++ oozie/trunk/core/src/test/java/org/apache/oozie/command/coord/TestCoordActionInputCheckXCommand.java Sat Sep  7 00:25:30 2013
@@ -36,8 +36,8 @@ import org.apache.oozie.coord.CoordELFun
 import org.apache.oozie.executor.jpa.CoordActionGetForInputCheckJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionGetJPAExecutor;
 import org.apache.oozie.executor.jpa.CoordActionInsertJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordActionUpdateForInputCheckJPAExecutor;
-import org.apache.oozie.executor.jpa.CoordActionUpdatePushInputCheckJPAExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor;
+import org.apache.oozie.executor.jpa.CoordActionQueryExecutor.CoordActionQuery;
 import org.apache.oozie.executor.jpa.CoordJobInsertJPAExecutor;
 import org.apache.oozie.executor.jpa.JPAExecutorException;
 import org.apache.oozie.service.CallableQueueService;
@@ -235,7 +235,9 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
+        CoordActionQueryExecutor.getInstance().executeUpdate(
+                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
+                action);
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -280,7 +282,9 @@ public class TestCoordActionInputCheckXC
                 .execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         final String pushMissingDependency = "file://" + getTestCaseDir() + "/2009/02/05";
         action.setPushMissingDependencies(pushMissingDependency);
-        jpaService.execute(new CoordActionUpdatePushInputCheckJPAExecutor(action));
+        CoordActionQueryExecutor.getInstance().executeUpdate(
+                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK,
+                action);
 
         // Update action creation time
         String actionXML = action.getActionXml();
@@ -289,7 +293,9 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
+        CoordActionQueryExecutor.getInstance().executeUpdate(
+                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
+                action);
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -362,7 +368,9 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
+        CoordActionQueryExecutor.getInstance().executeUpdate(
+                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
+                action);
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -406,7 +414,9 @@ public class TestCoordActionInputCheckXC
                 .execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         final String pushMissingDependency = "file://" + getTestCaseDir() + "/2009/02/05";
         action.setPushMissingDependencies(pushMissingDependency);
-        jpaService.execute(new CoordActionUpdatePushInputCheckJPAExecutor(action));
+        CoordActionQueryExecutor.getInstance().executeUpdate(
+                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_PUSH_INPUTCHECK,
+                action);
 
         // Update action creation time
         String actionXML = action.getActionXml();
@@ -415,7 +425,9 @@ public class TestCoordActionInputCheckXC
                 + "\">");
         action.setActionXml(actionXML);
         action.setCreatedTime(DateUtils.parseDateOozieTZ(actionCreationTime));
-        jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
+        CoordActionQueryExecutor.getInstance().executeUpdate(
+                CoordActionQueryExecutor.CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK,
+                action);
         action = jpaService.execute(new CoordActionGetForInputCheckJPAExecutor(job.getId() + "@1"));
         assertTrue(action.getActionXml().contains("action-actual-time=\"2009-02-15T01:00")) ;
 
@@ -700,7 +712,7 @@ public class TestCoordActionInputCheckXC
         action.setStatus(CoordinatorAction.Status.WAITING);
         try {
             jpaService = Services.get().get(JPAService.class);
-            jpaService.execute(new CoordActionUpdateForInputCheckJPAExecutor(action));
+            CoordActionQueryExecutor.getInstance().executeUpdate(CoordActionQuery.UPDATE_COORD_ACTION_FOR_INPUTCHECK, action);
         }
         catch (JPAExecutorException se) {
             fail("Action ID " + coordJob.getId() + "@1" + " was not stored properly in db");