X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2Frest%2Fdaoimpl%2FCommonClassDaoImpl.java;h=c8b8c6a0513aab3fa4b5d0f3816d195ead60b926;hb=5ad6783ca5a09c0061b661a48210f6d8e22cd7d3;hp=e6514469c7fda08faa0f521ce9e4281446d8adec;hpb=6f2b3f2dd0e80895acd0f77aa5784e717be33696;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java index e6514469c..c8b8c6a05 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/daoimpl/CommonClassDaoImpl.java @@ -44,9 +44,11 @@ import org.onap.policy.rest.jpa.GroupPolicyScopeList; import org.onap.policy.rest.jpa.PolicyRoles; import org.onap.policy.xacml.api.XACMLErrorConstants; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Primary; import org.springframework.stereotype.Service; @Service("CommonClassDao") +@Primary public class CommonClassDaoImpl implements CommonClassDao{ private static final Log LOGGER = LogFactory.getLog(CommonClassDaoImpl.class); @@ -54,6 +56,7 @@ public class CommonClassDaoImpl implements CommonClassDao{ private static SessionFactory sessionFactory; + @Autowired private CommonClassDaoImpl(SessionFactory sessionFactory){ CommonClassDaoImpl.sessionFactory = sessionFactory; @@ -242,7 +245,12 @@ public class CommonClassDaoImpl implements CommonClassDao{ try { Query hbquery = session.createQuery(query); for (Map.Entry paramPair : params.entrySet()) { - hbquery.setParameter(paramPair.getKey(), paramPair.getValue()); + if(paramPair.getValue() instanceof java.lang.Long){ + hbquery.setLong(paramPair.getKey(), (long) paramPair.getValue()); + } + else{ + hbquery.setParameter(paramPair.getKey(), paramPair.getValue()); + } } data = hbquery.list(); tx.commit(); @@ -448,4 +456,8 @@ public class CommonClassDaoImpl implements CommonClassDao{ return null; } + public static void setSessionfactory(SessionFactory sessionfactory) { + sessionFactory = sessionfactory; + } + } \ No newline at end of file