(just to make clear: my app isn\'t really about employees and departments. I just use these terms for example\'s sake).
Each department has an employees collection, whic
There is no reason for you to load all the empoyees to memory. you should write a query using HQL/Critiria API/Linq to NHibernate to check if the employee already existing in the DB. for example:
var existingEmpoyee = session.Query()
.Where(e => e.Equals(newEmployee))
.FirstOrDefault();
if(existingEmployee != null)
// Insert new employee to DB