Hi
Im doing two IQuery in the same method, and when i call List on the second ( queryVersions.List() ), the object becames dirty. I quite dont see why, maybe its obvious but please tell me :) Caus i dont get it.
Code:
IList<DocumentDto> list = new List<DocumentDto>();
string hql = "from DocumentVersion as v where v.Document.Person.Id = :personId "
+ "and v.IsLatest = :isLatest order by v.UpdatedDateAndTime asc";
IQuery query = Session.CreateQuery(hql);
query.SetParameter("personId", personId);
query.SetParameter("isLatest", true);
IList versions = query.List();
foreach (DocumentVersion version in versions)
{
list.Add(DocumentTransformation.TransformToDocumentDto(version));
string hqlVersions = "from DocumentVersion as v where v.Document.Person.Id = :personId "
+ "and v.IsLatest = :isLatest and v.Document.Id = :latestId order by v.UpdatedDateAndTime ASC";
IQuery queryVersions = Session.CreateQuery(hqlVersions);
queryVersions.SetParameter("personId", personId);
queryVersions.SetParameter("isLatest", false);
queryVersions.SetParameter("latestId", version.Id);
IList versionsOther = queryVersions.List();
//After queryVersions.List() the objects becomes dirty
foreach (DocumentVersion c in versionsOther)
{
list.Add(DocumentTransformation.TransformToDocumentDto(c));
}
}