NHibernate.NonUniqueResultException: query did not return a unique result: 2
in NHibernate.Impl.AbstractQueryImpl.UniqueElement (IList list)
in NHibernate.Impl.CriteriaImpl.UniqueResult ()
in NHibernate.Impl.CriteriaImpl.UniqueResult [T] ()
in SDPJDomain.DataAccess.ProcessOID.ConfirmProcessor (String numProcess)
in D: \ SVN \ SDP \ SDPJ \ branches \ SDPJ-V3.0.0 \ SDPJDomain \
DataAccess \ ProcessData.cs: line 111
public static Process ConsultforNProcessER(string numProcess) { ISession session = NhibernateHelper.SessionCurrent; Process process; try { process = new Process(); ICriteria criteria = session.CreateCriteria(process.GetType()); //criteria.Add(NHibernate.Criterion.Expression.Sql("replace(replace(replace(Num_Proc_Judicial, '.'), '-'), '/') = replace(replace(replace(?, '.'), '-'), '/')", numProcess, NHibernateUtil.String)); criteria.Add(NHibernate.Criterion.Expression.Sql("regexp_replace(Num_Proc_Judicial || '/','[[:punct:]]','') = regexp_replace(? || '/','[[:punct:]]','')", numProcess, NHibernateUtil.String)); return criteria.UniqueResult<Process>(); } catch (Exception e) { throw new Exception(e.ToString()); } } Line 111 is in return criteria.UniqueResult <Process> (); Does anybody know how to solve this?