Previous CloneSet | Next CloneSet | Back to Main Report |
Clone Mass | Clones in CloneSet | Parameter Count | Clone Similarity | Syntax Category [Sequence Length] |
---|---|---|---|---|
60 | 3 | 6 | 0.951 | statement_list |
Clone Abstraction | Parameter Bindings |
Clone Instance (Click to see clone) | Line Count | Source Line | Source File |
---|---|---|---|
1 | 60 | 83 | src/NHibernate.Test/SubselectFetchTest/SubselectFetchFixture.cs |
2 | 60 | 148 | src/NHibernate.Test/SubselectFetchTest/SubselectFetchFixture.cs |
3 | 60 | 307 | src/NHibernate.Test/SubselectFetchTest/SubselectFetchFixture.cs |
| ||||
ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent("foo"); p.Children.Add(new Child("foo1")); p.Children.Add(new Child("foo2")); Parent q = new Parent("bar"); q.Children.Add(new Child("bar1")); q.Children.Add(new Child("bar2")); ArrayHelper.AddAll(q.MoreChildren, p.Children); s.Save(p); s.Save(q); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); sessions.Statistics.Clear(); IList parents = s.CreateQuery("from Parent where name between :bar and :foo order by name desc"). SetParameter("bar", "bar"). SetParameter("foo", "foo"). List (); p = (Parent) parents[0]; q = (Parent) parents[1]; Assert.IsFalse(NHibernateUtil.IsInitialized(p.Children)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(p.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(p.Children[0])); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(q.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children[0])); Assert.IsFalse(NHibernateUtil.IsInitialized(p.MoreChildren)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(p.MoreChildren.Count, 0); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(q.MoreChildren.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren[0])); Assert.AreEqual(3, sessions.Statistics.PrepareStatementCount); Child c = (Child) p.Children[0]; NHibernateUtil.Initialize(c.Friends); s.Delete(p); s.Delete(q); t.Commit(); s.Close(); |
| ||||
ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent("foo"); p.Children.Add(new Child("foo1")); p.Children.Add(new Child("foo2")); Parent q = new Parent("bar"); q.Children.Add(new Child("bar1")); q.Children.Add(new Child("bar2")); ArrayHelper.AddAll(q.MoreChildren, p.Children); s.Save(p); s.Save(q); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); sessions.Statistics.Clear(); IList parents = s.CreateQuery("from Parent where name between ? and ? order by name desc"). SetParameter(0, "bar"). SetParameter(1, "foo"). List (); p = (Parent) parents[0]; q = (Parent) parents[1]; Assert.IsFalse(NHibernateUtil.IsInitialized(p.Children)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(p.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(p.Children[0])); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(q.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children[0])); Assert.IsFalse(NHibernateUtil.IsInitialized(p.MoreChildren)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(p.MoreChildren.Count, 0); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(q.MoreChildren.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren[0])); Assert.AreEqual(3, sessions.Statistics.PrepareStatementCount); Child c = (Child) p.Children[0]; NHibernateUtil.Initialize(c.Friends); s.Delete(p); s.Delete(q); t.Commit(); s.Close(); |
| ||||
ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent("foo"); p.Children.Add(new Child("foo1")); p.Children.Add(new Child("foo2")); Parent q = new Parent("bar"); q.Children.Add(new Child("bar1")); q.Children.Add(new Child("bar2")); ArrayHelper.AddAll(q.MoreChildren, p.Children); s.Save(p); s.Save(q); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); sessions.Statistics.Clear(); IList parents = s.CreateCriteria( typeof(Parent)). Add (Expression.Between("Name", "bar", "foo")). AddOrder(Order.Desc("Name")). List (); p = (Parent) parents[0]; q = (Parent) parents[1]; Assert.IsFalse(NHibernateUtil.IsInitialized(p.Children)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(p.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(p.Children[0])); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(q.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children[0])); Assert.IsFalse(NHibernateUtil.IsInitialized(p.MoreChildren)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(p.MoreChildren.Count, 0); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(q.MoreChildren.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren[0])); Assert.AreEqual(3, sessions.Statistics.PrepareStatementCount); Child c = (Child) p.Children[0]; NHibernateUtil.Initialize(c.Friends); s.Delete(p); s.Delete(q); t.Commit(); s.Close(); |
| |||
ISession s = OpenSession(); ITransaction t = s.BeginTransaction(); Parent p = new Parent("foo"); p.Children.Add(new Child("foo1")); p.Children.Add(new Child("foo2")); Parent q = new Parent("bar"); q.Children.Add(new Child("bar1")); q.Children.Add(new Child("bar2")); ArrayHelper.AddAll(q.MoreChildren, p.Children); s.Save(p); s.Save(q); t.Commit(); s.Close(); s = OpenSession(); t = s.BeginTransaction(); sessions.Statistics.Clear(); IList parents = s. [[#variable5414dc60]]( [[#variable5414dc00]]). [[#variable5414dba0]]( [[#variable5414db00]]). [[#variable5414da40]]( [[#variable5414d960]]).List(); p = (Parent)parents[0]; q = (Parent)parents[1]; Assert.IsFalse(NHibernateUtil.IsInitialized(p.Children)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(p.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(p.Children[0])); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children)); Assert.AreEqual(q.Children.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.Children[0])); Assert.IsFalse(NHibernateUtil.IsInitialized(p.MoreChildren)); Assert.IsFalse(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(p.MoreChildren.Count, 0); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren)); Assert.AreEqual(q.MoreChildren.Count, 2); Assert.IsTrue(NHibernateUtil.IsInitialized(q.MoreChildren[0])); Assert.AreEqual(3, sessions.Statistics.PrepareStatementCount); Child c = (Child)p.Children[0]; NHibernateUtil.Initialize(c.Friends); s.Delete(p); s.Delete(q); t.Commit(); s.Close(); |
CloneAbstraction |
Parameter Index | Clone Instance | Parameter Name | Value |
---|---|---|---|
1 | 1 | [[#5414dc60]] | CreateQuery |
1 | 2 | [[#5414dc60]] | CreateQuery |
1 | 3 | [[#5414dc60]] | CreateCriteria |
2 | 1 | [[#5414dc00]] | "from Parent where name between :bar and :foo order by name desc" |
2 | 2 | [[#5414dc00]] | "from Parent where name between ? and ? order by name desc" |
2 | 3 | [[#5414dc00]] | typeof(Parent) |
3 | 1 | [[#5414dba0]] | SetParameter |
3 | 2 | [[#5414dba0]] | SetParameter |
3 | 3 | [[#5414dba0]] | Add |
4 | 1 | [[#5414db00]] | "bar", "bar" |
4 | 2 | [[#5414db00]] | 0, "bar" |
4 | 3 | [[#5414db00]] | Expression.Between("Name", "bar", "foo") |
5 | 1 | [[#5414da40]] | SetParameter |
5 | 2 | [[#5414da40]] | SetParameter |
5 | 3 | [[#5414da40]] | AddOrder |
6 | 1 | [[#5414d960]] | "foo", "foo" |
6 | 2 | [[#5414d960]] | 1, "foo" |
6 | 3 | [[#5414d960]] | Order.Desc("Name") |