falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject falcon git commit: FALCON-1867 Hardcoded query names in JDBCStateStore
Date Tue, 29 Mar 2016 14:23:06 GMT
Repository: falcon
Updated Branches:
  refs/heads/master de2f5c0ab -> 01fe388ad


FALCON-1867 Hardcoded query names in JDBCStateStore

Author: Praveen Adlakha <adlakha.praveen@gmail.com>

Reviewers: Ajay Yadava <ajayyadava@apache.org>

Closes #79 from PraveenAdlakha/1867


Project: http://git-wip-us.apache.org/repos/asf/falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/falcon/commit/01fe388a
Tree: http://git-wip-us.apache.org/repos/asf/falcon/tree/01fe388a
Diff: http://git-wip-us.apache.org/repos/asf/falcon/diff/01fe388a

Branch: refs/heads/master
Commit: 01fe388ad2812afe5d83a5ecef6688d6e1e248b6
Parents: de2f5c0
Author: Praveen Adlakha <adlakha.praveen@gmail.com>
Authored: Tue Mar 29 19:49:45 2016 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Tue Mar 29 19:49:45 2016 +0530

----------------------------------------------------------------------
 .../apache/falcon/persistence/EntityBean.java   | 14 ++++----
 .../apache/falcon/persistence/InstanceBean.java | 24 ++++++-------
 .../persistence/PersistenceConstants.java       | 23 +++++++++++-
 .../falcon/state/store/jdbc/JDBCStateStore.java | 38 ++++++++++----------
 4 files changed, 61 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/01fe388a/common/src/main/java/org/apache/falcon/persistence/EntityBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/persistence/EntityBean.java b/common/src/main/java/org/apache/falcon/persistence/EntityBean.java
index 5c94fa4..274305c 100644
--- a/common/src/main/java/org/apache/falcon/persistence/EntityBean.java
+++ b/common/src/main/java/org/apache/falcon/persistence/EntityBean.java
@@ -36,13 +36,13 @@ import java.util.List;
  */
 @Entity
 @NamedQueries({
-        @NamedQuery(name = "GET_ENTITY", query = "select OBJECT(a) from EntityBean a where
a.id = :id"),
-        @NamedQuery(name = "GET_ENTITY_FOR_STATE", query = "select OBJECT(a) from EntityBean
a where a.state = :state"),
-        @NamedQuery(name = "UPDATE_ENTITY", query = "update EntityBean a set a.state = :state,
a.name = :name, a.type = :type where a.id = :id"),
-        @NamedQuery(name = "GET_ENTITIES_FOR_TYPE", query = "select OBJECT(a) from EntityBean
a where a.type = :type"),
-        @NamedQuery(name = "GET_ENTITIES", query = "select OBJECT(a) from EntityBean a"),
-        @NamedQuery(name = "DELETE_ENTITY", query = "delete from EntityBean a where a.id
= :id"),
-        @NamedQuery(name = "DELETE_ENTITIES", query = "delete from EntityBean")})
+        @NamedQuery(name = PersistenceConstants.GET_ENTITY, query = "select OBJECT(a) from
EntityBean a where a.id = :id"),
+        @NamedQuery(name = PersistenceConstants.GET_ENTITY_FOR_STATE, query = "select OBJECT(a)
from EntityBean a where a.state = :state"),
+        @NamedQuery(name = PersistenceConstants.UPDATE_ENTITY, query = "update EntityBean
a set a.state = :state, a.name = :name, a.type = :type where a.id = :id"),
+        @NamedQuery(name = PersistenceConstants.GET_ENTITIES_FOR_TYPE, query = "select OBJECT(a)
from EntityBean a where a.type = :type"),
+        @NamedQuery(name = PersistenceConstants.GET_ENTITIES, query = "select OBJECT(a) from
EntityBean a"),
+        @NamedQuery(name = PersistenceConstants.DELETE_ENTITY, query = "delete from EntityBean
a where a.id = :id"),
+        @NamedQuery(name = PersistenceConstants.DELETE_ENTITIES, query = "delete from EntityBean")})
 //RESUME CHECKSTYLE CHECK  LineLengthCheck
 @Table(name = "ENTITIES")
 public class EntityBean {

http://git-wip-us.apache.org/repos/asf/falcon/blob/01fe388a/common/src/main/java/org/apache/falcon/persistence/InstanceBean.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/persistence/InstanceBean.java b/common/src/main/java/org/apache/falcon/persistence/InstanceBean.java
index b7e10f1..0410b14 100644
--- a/common/src/main/java/org/apache/falcon/persistence/InstanceBean.java
+++ b/common/src/main/java/org/apache/falcon/persistence/InstanceBean.java
@@ -40,18 +40,18 @@ import java.sql.Timestamp;
  */
 @Entity
 @NamedQueries({
-        @NamedQuery(name = "GET_INSTANCE", query = "select OBJECT(a) from InstanceBean a
where a.id = :id"),
-        @NamedQuery(name = "GET_INSTANCE_FOR_EXTERNAL_ID", query = "select OBJECT(a) from
InstanceBean a where a.externalID = :externalID"),
-        @NamedQuery(name = "DELETE_INSTANCE", query = "delete from InstanceBean a where a.id
= :id"),
-        @NamedQuery(name = "DELETE_INSTANCE_FOR_ENTITY", query = "delete from InstanceBean
a where a.entityId = :entityId"),
-        @NamedQuery(name = "UPDATE_INSTANCE", query = "update InstanceBean a set a.cluster
= :cluster, a.externalID = :externalID, a.instanceTime = :instanceTime, a.creationTime = :creationTime,
a.actualEndTime = :actualEndTime, a.currentState = :currentState, a.actualStartTime = :actualStartTime,
a.instanceSequence = :instanceSequence, a.awaitedPredicates = :awaitedPredicates, a.properties
= :properties where a.id = :id"),
-        @NamedQuery(name = "GET_INSTANCES_FOR_ENTITY_CLUSTER", query = "select OBJECT(a)
from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster"),
-        @NamedQuery(name = "GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES", query = "select
OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster AND a.currentState
IN (:currentState)"),
-        @NamedQuery(name = "GET_INSTANCES_FOR_ENTITY_FOR_STATES", query = "select OBJECT(a)
from InstanceBean a where a.entityId = :entityId AND a.currentState IN (:currentState)"),
-        @NamedQuery(name = "GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES_WITH_RANGE", query
= "select OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster
AND a.currentState IN (:currentState) AND a.instanceTime >= :startTime AND a.instanceTime
< :endTime"),
-        @NamedQuery(name = "GET_LAST_INSTANCE_FOR_ENTITY_CLUSTER", query = "select OBJECT(a)
from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster order by a.instanceTime
desc"),
-        @NamedQuery(name = "DELETE_INSTANCES_TABLE", query = "delete from InstanceBean a"),
-        @NamedQuery(name = "GET_INSTANCE_SUMMARY_BY_STATE_WITH_RANGE", query = "select a.currentState,
COUNT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster AND a.instanceTime
>= :startTime AND a.instanceTime < :endTime GROUP BY a.currentState")
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCE, query = "select OBJECT(a) from
InstanceBean a where a.id = :id"),
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCE_FOR_EXTERNAL_ID, query = "select
OBJECT(a) from InstanceBean a where a.externalID = :externalID"),
+        @NamedQuery(name = PersistenceConstants.DELETE_INSTANCE, query = "delete from InstanceBean
a where a.id = :id"),
+        @NamedQuery(name = PersistenceConstants.DELETE_INSTANCE_FOR_ENTITY, query = "delete
from InstanceBean a where a.entityId = :entityId"),
+        @NamedQuery(name = PersistenceConstants.UPDATE_INSTANCE, query = "update InstanceBean
a set a.cluster = :cluster, a.externalID = :externalID, a.instanceTime = :instanceTime, a.creationTime
= :creationTime, a.actualEndTime = :actualEndTime, a.currentState = :currentState, a.actualStartTime
= :actualStartTime, a.instanceSequence = :instanceSequence, a.awaitedPredicates = :awaitedPredicates,
a.properties = :properties where a.id = :id"),
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCES_FOR_ENTITY_CLUSTER, query =
"select OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster"),
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES,
query = "select OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster =
:cluster AND a.currentState IN (:currentState)"),
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCES_FOR_ENTITY_FOR_STATES, query
= "select OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.currentState IN
(:currentState)"),
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES_WITH_RANGE,
query = "select OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster =
:cluster AND a.currentState IN (:currentState) AND a.instanceTime >= :startTime AND a.instanceTime
< :endTime"),
+        @NamedQuery(name =  PersistenceConstants.GET_LAST_INSTANCE_FOR_ENTITY_CLUSTER, query
= "select OBJECT(a) from InstanceBean a where a.entityId = :entityId AND a.cluster = :cluster
order by a.instanceTime desc"),
+        @NamedQuery(name = PersistenceConstants.DELETE_INSTANCES_TABLE, query = "delete from
InstanceBean a"),
+        @NamedQuery(name = PersistenceConstants.GET_INSTANCE_SUMMARY_BY_STATE_WITH_RANGE,
query = "select a.currentState, COUNT(a) from InstanceBean a where a.entityId = :entityId
AND a.cluster = :cluster AND a.instanceTime >= :startTime AND a.instanceTime < :endTime
GROUP BY a.currentState")
 })
 //RESUME CHECKSTYLE CHECK  LineLengthCheck
 @Table(name = "INSTANCES")

http://git-wip-us.apache.org/repos/asf/falcon/blob/01fe388a/common/src/main/java/org/apache/falcon/persistence/PersistenceConstants.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/persistence/PersistenceConstants.java
b/common/src/main/java/org/apache/falcon/persistence/PersistenceConstants.java
index 511270e..e554581 100644
--- a/common/src/main/java/org/apache/falcon/persistence/PersistenceConstants.java
+++ b/common/src/main/java/org/apache/falcon/persistence/PersistenceConstants.java
@@ -24,7 +24,7 @@ public final class PersistenceConstants {
     private PersistenceConstants(){
 
     }
-    public static final String  GET_MONITERED_INSTANCE = "GET_MONITERED_INSTANCE";
+    public static final String GET_MONITERED_INSTANCE = "GET_MONITERED_INSTANCE";
     public static final String DELETE_MONITORED_INSTANCES = "DELETE_MONITORED_INSTANCES";
     public static final String GET_ALL_MONITORING_FEEDS = "GET_ALL_MONITORING_FEEDS";
     public static final String GET_PENDING_INSTANCES = "GET_PENDING_INSTANCES";
@@ -32,4 +32,25 @@ public final class PersistenceConstants {
     public static final String DELETE_ALL_INSTANCES_FOR_FEED = "DELETE_ALL_INSTANCES_FOR_FEED";
     public static final String GET_DATE_FOR_PENDING_INSTANCES = "GET_DATE_FOR_PENDING_INSTANCES";
     public static final String GET_ALL_PENDING_INSTANCES = "GET_ALL_PENDING_INSTANCES";
+    public static final String GET_ENTITY = "GET_ENTITY";
+    public static final String GET_ENTITY_FOR_STATE = "GET_ENTITY_FOR_STATE";
+    public static final String UPDATE_ENTITY = "UPDATE_ENTITY";
+    public static final String GET_ENTITIES_FOR_TYPE = "GET_ENTITIES_FOR_TYPE";
+    public static final String GET_ENTITIES = "GET_ENTITIES";
+    public static final String DELETE_ENTITY = "DELETE_ENTITY";
+    public static final String DELETE_ENTITIES = "DELETE_ENTITIES";
+    public static final String GET_INSTANCE = "GET_INSTANCE";
+    public static final String GET_INSTANCE_FOR_EXTERNAL_ID = "GET_INSTANCE_FOR_EXTERNAL_ID";
+    public static final String DELETE_INSTANCE = "DELETE_INSTANCE";
+    public static final String DELETE_INSTANCE_FOR_ENTITY = "DELETE_INSTANCE_FOR_ENTITY";
+    public static final String UPDATE_INSTANCE = "UPDATE_INSTANCE";
+    public static final String GET_INSTANCES_FOR_ENTITY_CLUSTER = "GET_INSTANCES_FOR_ENTITY_CLUSTER";
+    public static final String GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES =
+            "GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES";
+    public static final String GET_INSTANCES_FOR_ENTITY_FOR_STATES = "GET_INSTANCES_FOR_ENTITY_FOR_STATES";
+    public static final String GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES_WITH_RANGE =
+            "GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES_WITH_RANGE";
+    public static final String GET_LAST_INSTANCE_FOR_ENTITY_CLUSTER = "GET_LAST_INSTANCE_FOR_ENTITY_CLUSTER";
+    public static final String DELETE_INSTANCES_TABLE = "DELETE_INSTANCES_TABLE";
+    public static final String GET_INSTANCE_SUMMARY_BY_STATE_WITH_RANGE = "GET_INSTANCE_SUMMARY_BY_STATE_WITH_RANGE";
 }

http://git-wip-us.apache.org/repos/asf/falcon/blob/01fe388a/scheduler/src/main/java/org/apache/falcon/state/store/jdbc/JDBCStateStore.java
----------------------------------------------------------------------
diff --git a/scheduler/src/main/java/org/apache/falcon/state/store/jdbc/JDBCStateStore.java
b/scheduler/src/main/java/org/apache/falcon/state/store/jdbc/JDBCStateStore.java
index d2bb8c8..2195c54 100644
--- a/scheduler/src/main/java/org/apache/falcon/state/store/jdbc/JDBCStateStore.java
+++ b/scheduler/src/main/java/org/apache/falcon/state/store/jdbc/JDBCStateStore.java
@@ -24,6 +24,7 @@ import org.apache.falcon.exception.StateStoreException;
 import org.apache.falcon.execution.ExecutionInstance;
 import org.apache.falcon.persistence.EntityBean;
 import org.apache.falcon.persistence.InstanceBean;
+import org.apache.falcon.persistence.PersistenceConstants;
 import org.apache.falcon.state.EntityClusterID;
 import org.apache.falcon.state.EntityID;
 import org.apache.falcon.state.EntityState;
@@ -101,7 +102,7 @@ public final class JDBCStateStore extends AbstractStateStore {
 
     private EntityBean getEntityBean(EntityID id) {
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_ENTITY");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_ENTITY);
         q.setParameter("id", id.getKey());
         List result = q.getResultList();
         if (result.isEmpty()) {
@@ -119,7 +120,7 @@ public final class JDBCStateStore extends AbstractStateStore {
     @Override
     public Collection<Entity> getEntities(EntityState.STATE state) throws StateStoreException
{
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_ENTITY_FOR_STATE");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_ENTITY_FOR_STATE);
         q.setParameter("state", state.toString());
         List result = q.getResultList();
         entityManager.close();
@@ -129,7 +130,7 @@ public final class JDBCStateStore extends AbstractStateStore {
     @Override
     public Collection<EntityState> getAllEntities() throws StateStoreException {
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_ENTITIES");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_ENTITIES);
         List result = q.getResultList();
         entityManager.close();
         return BeanMapperUtil.convertToEntityState(result);
@@ -143,7 +144,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         }
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("UPDATE_ENTITY");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.UPDATE_ENTITY);
         q.setParameter("id", entityID.getKey());
         if (entityState.getCurrentState() != null) {
             q.setParameter("state", entityState.getCurrentState().toString());
@@ -161,7 +162,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         }
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("DELETE_ENTITY");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.DELETE_ENTITY);
         q.setParameter("id", entityID.getKey());
         q.executeUpdate();
         commitAndCloseTransaction(entityManager);
@@ -174,7 +175,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         }
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("DELETE_ENTITIES");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.DELETE_ENTITIES);
         q.executeUpdate();
         commitAndCloseTransaction(entityManager);
     }
@@ -215,7 +216,7 @@ public final class JDBCStateStore extends AbstractStateStore {
 
     private InstanceState getExecutionInstanceByKey(ID instanceKey) throws StateStoreException
{
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCE");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_INSTANCE);
         q.setParameter("id", instanceKey.toString());
         List result = q.getResultList();
         entityManager.close();
@@ -236,7 +237,7 @@ public final class JDBCStateStore extends AbstractStateStore {
             throw new StateStoreException("External ID for retrieving instance cannot be
null or empty");
         }
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCE_FOR_EXTERNAL_ID");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_INSTANCE_FOR_EXTERNAL_ID);
         q.setParameter("externalID", externalID);
         List result = q.getResultList();
         entityManager.close();
@@ -262,7 +263,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         }
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("UPDATE_INSTANCE");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.UPDATE_INSTANCE);
         ExecutionInstance instance = instanceState.getInstance();
         q.setParameter("id", key);
         q.setParameter("cluster", instance.getCluster());
@@ -301,7 +302,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         throws StateStoreException {
         EntityClusterID id = new EntityClusterID(entity, cluster);
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCES_FOR_ENTITY_CLUSTER");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_INSTANCES_FOR_ENTITY_CLUSTER);
         q.setParameter("entityId", id.getEntityID().getKey());
         q.setParameter("cluster", cluster);
         List result  = q.getResultList();
@@ -320,7 +321,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         EntityClusterID entityClusterID = new EntityClusterID(entity, cluster);
         String entityKey = entityClusterID.getEntityID().getKey();
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES);
         q.setParameter("entityId", entityKey);
         q.setParameter("cluster", cluster);
         List<String> instanceStates = new ArrayList<>();
@@ -343,7 +344,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         throws StateStoreException {
         String entityKey = id.getEntityID().getKey();
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCES_FOR_ENTITY_FOR_STATES");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_INSTANCES_FOR_ENTITY_FOR_STATES);
         q.setParameter("entityId", entityKey);
         List<String> instanceStates = new ArrayList<>();
         for (InstanceState.STATE state : states) {
@@ -364,7 +365,7 @@ public final class JDBCStateStore extends AbstractStateStore {
             DateTime start, DateTime end) throws StateStoreException {
         String entityKey = new EntityClusterID(entity, cluster).getEntityID().getKey();
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCE_SUMMARY_BY_STATE_WITH_RANGE");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_INSTANCE_SUMMARY_BY_STATE_WITH_RANGE);
         q.setParameter("entityId", entityKey);
         q.setParameter("cluster", cluster);
         q.setParameter("startTime", new Timestamp(start.getMillis()));
@@ -381,7 +382,8 @@ public final class JDBCStateStore extends AbstractStateStore {
                                                            DateTime end) throws StateStoreException
{
         String entityKey = new EntityClusterID(entity, cluster).getEntityID().getKey();
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES_WITH_RANGE");
+        Query q = entityManager.
+                createNamedQuery(PersistenceConstants.GET_INSTANCES_FOR_ENTITY_CLUSTER_FOR_STATES_WITH_RANGE);
         q.setParameter("entityId", entityKey);
         List<String> instanceStates = new ArrayList<>();
         for (InstanceState.STATE state : states) {
@@ -404,7 +406,7 @@ public final class JDBCStateStore extends AbstractStateStore {
     public InstanceState getLastExecutionInstance(Entity entity, String cluster) throws StateStoreException
{
         String key = new EntityClusterID(entity, cluster).getEntityID().getKey();
         EntityManager entityManager = getEntityManager();
-        Query q = entityManager.createNamedQuery("GET_LAST_INSTANCE_FOR_ENTITY_CLUSTER");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.GET_LAST_INSTANCE_FOR_ENTITY_CLUSTER);
         q.setParameter("entityId", key);
         q.setParameter("cluster", cluster);
         q.setMaxResults(1);
@@ -433,7 +435,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         }
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("DELETE_INSTANCE");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.DELETE_INSTANCE);
         q.setParameter("id", instanceKey);
         q.executeUpdate();
         commitAndCloseTransaction(entityManager);
@@ -444,7 +446,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         String entityKey = entityID.getKey();
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("DELETE_INSTANCE_FOR_ENTITY");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.DELETE_INSTANCE_FOR_ENTITY);
         q.setParameter("entityId", entityKey);
         q.executeUpdate();
         commitAndCloseTransaction(entityManager);
@@ -457,7 +459,7 @@ public final class JDBCStateStore extends AbstractStateStore {
         }
         EntityManager entityManager = getEntityManager();
         beginTransaction(entityManager);
-        Query q = entityManager.createNamedQuery("DELETE_INSTANCES_TABLE");
+        Query q = entityManager.createNamedQuery(PersistenceConstants.DELETE_INSTANCES_TABLE);
         q.executeUpdate();
         commitAndCloseTransaction(entityManager);
     }


Mime
View raw message