String hql = "select count(c.userContactId) from UserContacts c " +
"where c.contact.user_id = :user_id AND c.owner.user_id = :ownerId ";
Object idf = PersistenceSessionUtil.createSession();
EntityManager session = PersistenceSessionUtil.getSession();
EntityTransaction tx = session.getTransaction();
tx.begin();
Query query = session.createQuery(hql);
query.setParameter("user_id", user_id);
query.setParameter("ownerId", ownerId);
List ll = query.getResultList();
tx.commit();
PersistenceSessionUtil.closeSession(idf);
log.info("checkUserContacts"+(Long)ll.get(0));
return (Long)ll.get(0);