How do you write this in NHibernate?
criteria
.CreateAlias( "CreatorObject.LastCreated", "me" )
.Add( Restrictions.Eq( this, "me" ) );
Edit: something like this without using sql
Where there are two tables TypeA and TypeB where typeB creates typeA objects and keeps a reference to the last object created.
criteria
.Add( Restrictions.IdEq( Projections.SqlProjection( "(Select LastCreated From Creators Where Creators.Id = CreatorId) as MasterId", new[] { "MasterId" }, new[] { NHibernateUtil.Int32 } ) ) );