UdpValue toReturn = null;
Session tmpSession = getSession();
Transaction tx = null;
try {
tx = tmpSession.beginTransaction();
Criterion labelCriterrion = Expression.eq("referenceId", referenceId);
Criteria criteria = tmpSession.createCriteria(SbiUdpValue.class );
criteria.add(labelCriterrion);
Criterion labelCriterrion2 = Expression.eq("sbiUdp.udpId", udpId);
criteria.add(labelCriterrion2);
Criterion labelCriterrion3 = Expression.eq("family", family);
criteria.add(labelCriterrion3);
// take not closed ones!
Criterion labelCriterrion4 = Expression.isNull("endTs");
criteria.add(labelCriterrion4);
SbiUdpValue hibValueUDP = (SbiUdpValue) criteria.uniqueResult();
if (hibValueUDP == null) return null;
toReturn = toUdpValue(hibValueUDP);