public void OuterJoin() { ISession s = OpenSession(); Eye e = new Eye(); e.Name = "Eye Eye"; Jay jay = new Jay(e); e.Jay = jay; s.SaveOrUpdate(e); s.Flush(); s.Close(); s = OpenSession(); e = (Eye) s.CreateCriteria(typeof(Eye)).UniqueResult(); Assert.IsTrue(NHibernateUtil.IsInitialized(e.Jay)); Assert.IsTrue(NHibernateUtil.IsInitialized(e.Jays)); s.Close(); s = OpenSession(); jay = (Jay) s.CreateQuery("select new Jay(eye) from Eye eye").UniqueResult(); Assert.AreEqual("Eye Eye", jay.Eye.Name); s.Delete(jay.Eye); s.Flush(); s.Close(); }
public Jay(Eye eye) { eye.Jays.Add(this); this.eye = eye; }