CloneSet29


Previous CloneSetNext CloneSetBack to Main Report
Clone
Mass
Clones in
CloneSet
Parameter
Count
Clone
Similarity
Syntax Category
[Sequence Length]
60360.951statement_list
Clone AbstractionParameter Bindings
Clone Instance
(Click to see clone)
Line CountSource Line
Source File
16083
src/NHibernate.Test/SubselectFetchTest/SubselectFetchFixture.cs
260148
src/NHibernate.Test/SubselectFetchTest/SubselectFetchFixture.cs
360307
src/NHibernate.Test/SubselectFetchTest/SubselectFetchFixture.cs
Clone Instance
1
Line Count
60
Source Line
83
Source File
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();


Clone Instance
2
Line Count
60
Source Line
148
Source File
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 ? 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();


Clone Instance
3
Line Count
60
Source Line
307
Source File
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.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();


Clone AbstractionParameter Count: 6Parameter Bindings

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 Bindings
Parameter
Index
Clone
Instance
Parameter
Name
Value
11[[#5414dc60]]
CreateQuery 
12[[#5414dc60]]
CreateQuery 
13[[#5414dc60]]
CreateCriteria 
21[[#5414dc00]]
"from Parent where name between :bar and :foo order by name desc" 
22[[#5414dc00]]
"from Parent where name between ? and ? order by name desc" 
23[[#5414dc00]]
typeof(Parent) 
31[[#5414dba0]]
SetParameter 
32[[#5414dba0]]
SetParameter 
33[[#5414dba0]]
Add 
41[[#5414db00]]
"bar", "bar" 
42[[#5414db00]]
0, "bar" 
43[[#5414db00]]
Expression.Between("Name", "bar", "foo") 
51[[#5414da40]]
SetParameter 
52[[#5414da40]]
SetParameter 
53[[#5414da40]]
AddOrder 
61[[#5414d960]]
"foo", "foo" 
62[[#5414d960]]
1, "foo" 
63[[#5414d960]]
Order.Desc("Name")