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=c7148213d487e668ab9650652b53f99fae01911e;hb=b3828de54af94f66e3a6e22bcaeb3372d14eab34;hp=5d2b7f6c7c5a6262e096634fd7d3daaf5dd99353;hpb=515e216bd6e561a73810c1b970307b177ecde8d1;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 5d2b7f6c7..c7148213d 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,12 @@ 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.Component; import org.springframework.stereotype.Service; @Service("CommonClassDao") +@Primary public class CommonClassDaoImpl implements CommonClassDao{ private static final Log LOGGER = LogFactory.getLog(CommonClassDaoImpl.class); @@ -54,6 +57,7 @@ public class CommonClassDaoImpl implements CommonClassDao{ private static SessionFactory sessionFactory; + @Autowired private CommonClassDaoImpl(SessionFactory sessionFactory){ CommonClassDaoImpl.sessionFactory = sessionFactory; @@ -242,7 +246,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();