Session s = openSession(); Transaction t = s.beginTransaction(); Multi multi = new Multi(); multi.setExtraProp("extra"); multi.setName("name"); Top simp = new Top(); simp.setDate( new Date() ); simp.setName("simp"); Serializable mid = s.save(multi); Serializable sid = s.save(simp); SubMulti sm = new SubMulti(); sm.setAmount(66.5f); Serializable smid = s.save(sm); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi.setExtraProp( multi.getExtraProp() + "2" ); //multi.setCount( multi.getCount() + 1 ); multi.setName("new name"); s.update(multi, mid); simp.setName("new name"); s.update(simp, sid); sm.setAmount(456.7f); s.update(sm, smid); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi = (Multi) s.load(Multi.class, mid); assertTrue( multi.getExtraProp().equals("extra2") ); multi.setExtraProp( multi.getExtraProp() + "3" ); //multi.setCount( multi.getCount() + 1 ); assertTrue( multi.getName().equals("new name") ); multi.setName("newer name"); sm = (SubMulti) s.load(SubMulti.class, smid); assertTrue( sm.getAmount()==456.7f ); sm.setAmount(23423f); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi = (Multi) s.load(Top.class, mid); simp = (Top) s.load(Top.class, sid); assertTrue( ! (simp instanceof Multi) ); assertTrue( multi.getExtraProp().equals("extra23") ); //multi.setCount( multi.getCount() + 1 ); assertTrue( multi.getName().equals("newer name") ); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); Iterator iter = s.iterate("select\n\nt from Top t where t.count>0"); boolean foundSimp = false; boolean foundMulti = false; boolean foundSubMulti = false; while ( iter.hasNext() ) { Object o = iter.next(); if ( ( o instanceof Top ) && !( o instanceof Multi) ) foundSimp = true; if ( o instanceof Multi && !(o instanceof SubMulti) ) foundMulti = true; if ( o instanceof SubMulti ) foundSubMulti = true; } assertTrue( foundSimp&&foundMulti&&foundSubMulti ); s.find("from Multi m where m.count>0 and m.extraProp is not null"); s.find("from Top m where m.count>0 and m.name is not null"); s.find("from Lower m where m.other is not null"); s.find("from Multi m where m.other.id = 1"); s.find("from SubMulti m where m.amount > 0.0"); assertTrue( s.find("from Multi").size()==2 ); assertTrue( s.find("from Multi m where m.class = SubMulti").size()==1 ); assertTrue( s.find("from Top m where m.class = Multi").size()==1 ); assertTrue( s.find("from Top").size()==3 ); assertTrue( s.find("from Lower").size()==0 ); assertTrue( s.find("from SubMulti").size()==1 ); s.find("from Lower ls join ls.bag s where s.id is not null"); s.find("from Lower ls join ls.set s where s.id is not null"); if ( !(getDialect() instanceof MySQLDialect) ) s.find("from SubMulti sm where exists elements(sm.children)"); List l = s.createCriteria(Top.class).list(); assertTrue( l.size()==3 ); assertTrue( s.createCriteria(SubMulti.class).list().size()==1 ); assertTrue( s.createCriteria(SubMulti.class) .add( Restrictions.lt("amount", new Float(0)) ) .list() .size()==0 ); assertTrue( s.createCriteria(SubMulti.class) .add( Restrictions.ge("amount", new Float(0)) ) .list() .size()==1 ); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi = (Multi) s.load(Top.class, mid, LockMode.UPGRADE); simp = (Top) s.load(Top.class, sid); s.lock(simp, LockMode.UPGRADE_NOWAIT); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); s.update(multi, mid); s.delete(multi); assertTrue( s.delete("from Top")==2); t.commit(); s.close();
Session s = openSession(); Transaction t = s.beginTransaction(); Multi multi = new Multi(); multi.setExtraProp("extra"); //multi.setCount(666); multi.setName("name"); Top simp = new Top(); simp.setDate( new Date() ); simp.setName("simp"); //simp.setCount(132); Serializable multiId = s.save( multi ); Serializable simpId = s.save( simp ); SubMulti sm = new SubMulti(); sm.setAmount(66.5f); Serializable smId = s.save( sm ); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi.setExtraProp( multi.getExtraProp() + "2" ); //multi.setCount( multi.getCount() + 1 ); multi.setName("new name"); s.update( multi, multiId ); simp.setName("new name"); s.update( simp, simpId ); sm.setAmount(456.7f); s.update( sm, smId ); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi = (Multi) s.load( Multi.class, multiId ); assertTrue( multi.getExtraProp().equals("extra2") ); multi.setExtraProp( multi.getExtraProp() + "3" ); //multi.setCount( multi.getCount() + 1 ); assertTrue( multi.getName().equals("new name") ); multi.setName("newer name"); sm = (SubMulti) s.load( SubMulti.class, smId ); assertTrue( sm.getAmount()==456.7f ); sm.setAmount(23423f); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi = (Multi) s.load( Top.class, multiId ); simp = (Top) s.load( Top.class, simpId ); assertTrue( ! (simp instanceof Multi) ); assertTrue( multi.getExtraProp().equals("extra23") ); //multi.setCount( multi.getCount() + 1 ); assertTrue( multi.getName().equals("newer name") ); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); Iterator iter = s.iterate("select\n\nt from Top t where t.count>0"); boolean foundSimp = false; boolean foundMulti = false; boolean foundSubMulti = false; while ( iter.hasNext() ) { Object o = iter.next(); if ( ( o instanceof Top ) && !( o instanceof Multi) ) foundSimp = true; if ( o instanceof Multi && !(o instanceof SubMulti) ) foundMulti = true; if ( o instanceof SubMulti ) foundSubMulti = true; } assertTrue( foundSimp&&foundMulti&&foundSubMulti ); s.find("from Multi m where m.count>0 and m.extraProp is not null"); s.find("from Top m where m.count>0 and m.name is not null"); s.find("from Lower m where m.other is not null"); s.find("from Multi m where m.other.id = 1"); s.find("from SubMulti m where m.amount > 0.0"); assertTrue( s.find("from Multi").size()==2 ); /*assertTrue( s.find("from m in class Multi where m.class = Multi").size()==1 );*/ assertTrue( s.find("from Top").size()==3 ); assertTrue( s.find("from Lower").size()==0 ); assertTrue( s.find("from SubMulti").size()==1 ); s.find("from Lower ls join ls.bag s where s.id is not null"); if ( !(getDialect() instanceof MySQLDialect) ) s.find("from SubMulti sm where exists elements(sm.children)"); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); multi = (Multi) s.load( Top.class, multiId, LockMode.UPGRADE ); simp = (Top) s.load( Top.class, simpId ); s.lock(simp, LockMode.UPGRADE_NOWAIT); t.commit(); s.close(); s = openSession(); t = s.beginTransaction(); s.update( multi, multiId ); s.delete(multi); assertTrue( s.delete("from Top")==2); t.commit(); s.close();
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/MultiTableTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/MultiTableTest.java
Method name: void testMultiTable() Method name: void testMultiTableGeneratedId()
Number of AST nodes: 98 Number of AST nodes: 90
1
Session s = openSession();
1
Session s = openSession();
2
		Transaction t = s.beginTransaction();
2
		Transaction t = s.beginTransaction();
3
		Multi multi = new Multi();
3
		Multi multi = new Multi();
4
		multi.setExtraProp("extra");
4
		multi.setExtraProp("extra");
5
		
5
		//multi.setCount(666);
6
multi.setName("name");
6
		multi.setName("name");
7
		Top simp = new Top();
7
		Top simp = new Top();
8
		simp.setDate( new Date() );
8
		simp.setDate( new Date() );
9
		simp.setName("simp");
9
		simp.setName("simp");
10
		//simp.setCount(132);
10
		Serializable mid = s.save(multi);
11
		Serializable multiId = s.save( multi );
11
		Serializable sid = s.save(simp);
12
		Serializable simpId = s.save( simp );
12
		SubMulti sm = new SubMulti();
13
		SubMulti sm = new SubMulti();
13
		sm.setAmount(66.5f);
14
		sm.setAmount(66.5f);
14
		Serializable smid = s.save(sm);
15
		Serializable smId = s.save( sm );
15
		t.commit();
16
		t.commit();
16
		s.close();
17
		s.close();
17
		s = openSession();
18
		s = openSession();
18
		t = s.beginTransaction();
19
		t = s.beginTransaction();
19
		multi.setExtraProp( multi.getExtraProp() + "2" );
20
		multi.setExtraProp( multi.getExtraProp() + "2" );
20
		//multi.setCount( multi.getCount() + 1 );
21
		//multi.setCount( multi.getCount() + 1 );
21
		multi.setName("new name");
22
		multi.setName("new name");
22
		s.update(multi, mid);
23
		s.update( multi, multiId );
23
		simp.setName("new name");
24
		simp.setName("new name");
24
		s.update(simp, sid);
25
		s.update( simp, simpId );
25
		sm.setAmount(456.7f);
26
		sm.setAmount(456.7f);
26
		s.update(sm, smid);
27
		s.update( sm, smId );
27
		t.commit();
28
		t.commit();
28
		s.close();
29
		s.close();
29
		s = openSession();
30
		s = openSession();
30
		t = s.beginTransaction();
31
		t = s.beginTransaction();
31
		multi = (Multi) s.load(Multi.class, mid);
32
		multi = (Multi) s.load( Multi.class, multiId );
32
		assertTrue( multi.getExtraProp().equals("extra2") );
33
		assertTrue( multi.getExtraProp().equals("extra2") );
33
		multi.setExtraProp( multi.getExtraProp() + "3" );
34
		multi.setExtraProp( multi.getExtraProp() + "3" );
34
		//multi.setCount( multi.getCount() + 1 );
35
		//multi.setCount( multi.getCount() + 1 );
35
		assertTrue( multi.getName().equals("new name") );
36
		assertTrue( multi.getName().equals("new name") );
36
		multi.setName("newer name");
37
		multi.setName("newer name");
37
		sm = (SubMulti) s.load(SubMulti.class, smid);
38
		sm = (SubMulti) s.load( SubMulti.class, smId );
38
		assertTrue( sm.getAmount()==456.7f );
39
		assertTrue( sm.getAmount()==456.7f );
39
		sm.setAmount(23423f);
40
		sm.setAmount(23423f);
40
		t.commit();
41
		t.commit();
41
		s.close();
42
		s.close();
42
		s = openSession();
43
		s = openSession();
43
		t = s.beginTransaction();
44
		t = s.beginTransaction();
44
		multi = (Multi) s.load(Top.class, mid);
45
		multi = (Multi) s.load( Top.class, multiId );
45
		simp = (Top) s.load(Top.class, sid);
46
		simp = (Top) s.load( Top.class, simpId );
46
		assertTrue( ! (simp instanceof Multi) );
47
		assertTrue( ! (simp instanceof Multi) );
47
		assertTrue( multi.getExtraProp().equals("extra23") );
48
		assertTrue( multi.getExtraProp().equals("extra23") );
48
		//multi.setCount( multi.getCount() + 1 );
49
		//multi.setCount( multi.getCount() + 1 );
49
		assertTrue( multi.getName().equals("newer name") );
50
		assertTrue( multi.getName().equals("newer name") );
50
		t.commit();
51
		t.commit();
51
		s.close();
52
		s.close();
52
		s = openSession();
53
		s = openSession();
53
		t = s.beginTransaction();
54
		t = s.beginTransaction();
54
		Iterator iter = s.iterate("select\n\nt from Top t where t.count>0");
55
		Iterator iter = s.iterate("select\n\nt from Top t where t.count>0");
55
		boolean foundSimp = false;
56
		boolean foundSimp = false;
56
		boolean foundMulti = false;
57
		boolean foundMulti = false;
57
		boolean foundSubMulti = false;
58
		boolean foundSubMulti = false;
58
		while ( iter.hasNext() ) {
59
		while ( iter.hasNext() ) {
59
			Object o = iter.next();
60
			Object o = iter.next();
60
			if ( ( o instanceof Top ) && !( o instanceof Multi) ) foundSimp = true;
61
			if ( ( o instanceof Top ) && !( o instanceof Multi) ) foundSimp = true;
61
			if ( o instanceof Multi && !(o instanceof SubMulti) ) foundMulti = true;
62
			if ( o instanceof Multi && !(o instanceof SubMulti) ) foundMulti = true;
62
			if ( o instanceof SubMulti ) foundSubMulti = true;
63
			if ( o instanceof SubMulti ) foundSubMulti = true;
63
		}
64
		}
64
		assertTrue( foundSimp&&foundMulti&&foundSubMulti );
65
		assertTrue( foundSimp&&foundMulti&&foundSubMulti );
65
		s.find("from Multi m where m.count>0 and m.extraProp is not null");
66
		s.find("from Multi m where m.count>0 and m.extraProp is not null");
66
		s.find("from Top m where m.count>0 and m.name is not null");
67
		s.find("from Top m where m.count>0 and m.name is not null");
67
		s.find("from Lower m where m.other is not null");
68
		s.find("from Lower m where m.other is not null");
68
		s.find("from Multi m where m.other.id = 1");
69
		s.find("from Multi m where m.other.id = 1");
69
		s.find("from SubMulti m where m.amount > 0.0");
70
		s.find("from SubMulti m where m.amount > 0.0");
70
		assertTrue(
71
		assertTrue(
71
			s.find("from Multi").size()==2
72
			s.find("from Multi").size()==2
72
		);
73
		);
73
		assertTrue(
74
		/*assertTrue(
74
			s.find("from Multi m where m.class = SubMulti").size()==1
75
			s.find("from 
75
		);
76
		assertTrue(
77
			s.find("from Top m where m.class = Multi").size()==1
76
m in class Multi where m.class = Multi").size()==1
78
		);
77
		);*/
79
		assertTrue(
78
		assertTrue(
80
			s.find("from Top").size()==3
79
			s.find("from Top").size()==3
81
		);
80
		);
82
		assertTrue(
81
		assertTrue(
83
			s.find("from Lower").size()==0
82
			s.find("from Lower").size()==0
84
		);
83
		);
85
		assertTrue(
84
		assertTrue(
86
			s.find("from SubMulti").size()==1
85
			s.find("from SubMulti").size()==1
87
		);
86
		);
88
		s.find("from Lower ls join ls.bag s where s.id is not null");
87
		s.find("from Lower ls join ls.bag s where s.id is not null");
89
		s.find("from Lower ls join ls.set s where s.id is not null");
88
		
90
		if ( !(getDialect() instanceof MySQLDialect) ) s.find("from SubMulti sm where exists elements(sm.children)");
89
if ( !(getDialect() instanceof MySQLDialect) ) s.find("from SubMulti sm where exists elements(sm.children)");
91
		List l = s.createCriteria(Top.class).list();
92
		assertTrue( l.size()==3 );
93
		assertTrue( s.createCriteria(SubMulti.class).list().size()==1 );
94
		assertTrue(
95
			s.createCriteria(SubMulti.class)
96
				.add( Restrictions.lt("amount", new Float(0)) )
97
				.list()
98
				.size()==0
99
		);
100
		assertTrue(
101
			s.createCriteria(SubMulti.class)
102
				.add( Restrictions.ge("amount", new Float(0)) )
103
				.list()
104
				.size()==1
105
		);
106
		t.commit();
90
		t.commit();
107
		s.close();
91
		s.close();
108
		s = openSession();
92
		s = openSession();
109
		t = s.beginTransaction();
93
		t = s.beginTransaction();
110
		multi = (Multi) s.load(Top.class, mid, LockMode.UPGRADE);
94
		multi = (Multi) s.load( Top.class, multiId, LockMode.UPGRADE );
111
		simp = (Top) s.load(Top.class, sid);
95
		simp = (Top) s.load( Top.class, simpId );
112
		s.lock(simp, LockMode.UPGRADE_NOWAIT);
96
		s.lock(simp, LockMode.UPGRADE_NOWAIT);
113
		t.commit();
97
		t.commit();
114
		s.close();
98
		s.close();
115
		s = openSession();
99
		s = openSession();
116
		t = s.beginTransaction();
100
		t = s.beginTransaction();
117
		s.update(multi, mid);
101
		s.update( multi, multiId );
118
		s.delete(multi);
102
		s.delete(multi);
119
		assertTrue( s.delete("from Top")==2);
103
		assertTrue( s.delete("from Top")==2);
120
		t.commit();
104
		t.commit();
121
		s.close();
105
		s.close();
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)15.3
Clones locationClones are declared in the same class
Number of node comparisons1989
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements90
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)10589.8
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Session s = openSession();
    1
    Session s = openSession();
    2
    Transaction t = s.beginTransaction();
    2
    Transaction t = s.beginTransaction();
    3
    Multi multi = new Multi();
    3
    Multi multi = new Multi();
    4
    multi.setExtraProp("extra");
    4
    multi.setExtraProp("extra");
    5
    multi.setName("name");
    5
    multi.setName("name");
    6
    Top simp = new Top();
    6
    Top simp = new Top();
    7
    simp.setDate(new Date());
    7
    simp.setDate(new Date());
    8
    simp.setName("simp");
    8
    simp.setName("simp");
    9
    Serializable mid = s.save(multi);
    9
    Serializable mid = s.save(multi);
    9
    Serializable multiId = s.save(multi);
    Differences
    Expression1Expression2Difference
    midmultiIdVARIABLE_NAME_MISMATCH
    9
    Serializable multiId = s.save(multi);
    10
    Serializable sid = s.save(simp);
    10
    Serializable sid = s.save(simp);
    10
    Serializable simpId = s.save(simp);
    Differences
    Expression1Expression2Difference
    sidsimpIdVARIABLE_NAME_MISMATCH
    10
    Serializable simpId = s.save(simp);
    11
    SubMulti sm = new SubMulti();
    11
    SubMulti sm = new SubMulti();
    12
    sm.setAmount(66.5f);
    12
    sm.setAmount(66.5f);
    13
    Serializable smid = s.save(sm);
    13
    Serializable smid = s.save(sm);
    13
    Serializable smId = s.save(sm);
    Differences
    Expression1Expression2Difference
    smidsmIdVARIABLE_NAME_MISMATCH
    13
    Serializable smId = s.save(sm);
    14
    t.commit();
    14
    t.commit();
    15
    s.close();
    15
    s.close();
    16
    s = openSession();
    16
    s = openSession();
    17
    t = s.beginTransaction();
    17
    t = s.beginTransaction();
    18
    multi.setExtraProp(multi.getExtraProp() + "2");
    18
    multi.setExtraProp(multi.getExtraProp() + "2");
    19
    multi.setName("new name");
    19
    multi.setName("new name");
    20
    s.update(multi, mid);
    20
    s.update(multi, mid);
    20
    s.update(multi, multiId);
    Differences
    Expression1Expression2Difference
    midmultiIdVARIABLE_NAME_MISMATCH
    20
    s.update(multi, multiId);
    21
    simp.setName("new name");
    21
    simp.setName("new name");
    22
    s.update(simp, sid);
    22
    s.update(simp, sid);
    22
    s.update(simp, simpId);
    Differences
    Expression1Expression2Difference
    sidsimpIdVARIABLE_NAME_MISMATCH
    22
    s.update(simp, simpId);
    23
    sm.setAmount(456.7f);
    23
    sm.setAmount(456.7f);
    24
    s.update(sm, smid);
    24
    s.update(sm, smid);
    24
    s.update(sm, smId);
    Differences
    Expression1Expression2Difference
    smidsmIdVARIABLE_NAME_MISMATCH
    24
    s.update(sm, smId);
    25
    t.commit();
    25
    t.commit();
    26
    s.close();
    26
    s.close();
    27
    s = openSession();
    27
    s = openSession();
    28
    t = s.beginTransaction();
    28
    t = s.beginTransaction();
    29
    multi = (Multi)s.load(Multi.class, mid);
    29
    multi = (Multi)s.load(Multi.class, mid);
    29
    multi = (Multi)s.load(Multi.class, multiId);
    Differences
    Expression1Expression2Difference
    midmultiIdVARIABLE_NAME_MISMATCH
    29
    multi = (Multi)s.load(Multi.class, multiId);
    30
    assertTrue(multi.getExtraProp().equals("extra2"));
    30
    assertTrue(multi.getExtraProp().equals("extra2"));
    31
    multi.setExtraProp(multi.getExtraProp() + "3");
    31
    multi.setExtraProp(multi.getExtraProp() + "3");
    32
    assertTrue(multi.getName().equals("new name"));
    32
    assertTrue(multi.getName().equals("new name"));
    33
    multi.setName("newer name");
    33
    multi.setName("newer name");
    34
    sm = (SubMulti)s.load(SubMulti.class, smid);
    34
    sm = (SubMulti)s.load(SubMulti.class, smid);
    34
    sm = (SubMulti)s.load(SubMulti.class, smId);
    Differences
    Expression1Expression2Difference
    smidsmIdVARIABLE_NAME_MISMATCH
    34
    sm = (SubMulti)s.load(SubMulti.class, smId);
    35
    assertTrue(sm.getAmount() == 456.7f);
    35
    assertTrue(sm.getAmount() == 456.7f);
    36
    sm.setAmount(23423f);
    36
    sm.setAmount(23423f);
    37
    t.commit();
    37
    t.commit();
    38
    s.close();
    38
    s.close();
    39
    s = openSession();
    39
    s = openSession();
    40
    t = s.beginTransaction();
    40
    t = s.beginTransaction();
    41
    multi = (Multi)s.load(Top.class, mid);
    41
    multi = (Multi)s.load(Top.class, mid);
    41
    multi = (Multi)s.load(Top.class, multiId);
    Differences
    Expression1Expression2Difference
    midmultiIdVARIABLE_NAME_MISMATCH
    41
    multi = (Multi)s.load(Top.class, multiId);
    42
    simp = (Top)s.load(Top.class, sid);
    42
    simp = (Top)s.load(Top.class, sid);
    42
    simp = (Top)s.load(Top.class, simpId);
    Differences
    Expression1Expression2Difference
    sidsimpIdVARIABLE_NAME_MISMATCH
    42
    simp = (Top)s.load(Top.class, simpId);
    43
    assertTrue(!(simp instanceof Multi));
    43
    assertTrue(!(simp instanceof Multi));
    44
    assertTrue(multi.getExtraProp().equals("extra23"));
    44
    assertTrue(multi.getExtraProp().equals("extra23"));
    45
    assertTrue(multi.getName().equals("newer name"));
    45
    assertTrue(multi.getName().equals("newer name"));
    46
    t.commit();
    46
    t.commit();
    47
    s.close();
    47
    s.close();
    48
    s = openSession();
    48
    s = openSession();
    49
    t = s.beginTransaction();
    49
    t = s.beginTransaction();
    50
    Iterator iter = s.iterate("select\n\nt from Top t where t.count>0");
    50
    Iterator iter = s.iterate("select\n\nt from Top t where t.count>0");
    51
    boolean foundSimp = false;
    51
    boolean foundSimp = false;
    52
    boolean foundMulti = false;
    52
    boolean foundMulti = false;
    53
    boolean foundSubMulti = false;
    53
    boolean foundSubMulti = false;
    54
    while (iter.hasNext())
    54
    while (iter.hasNext())
    55
    Object o = iter.next();
    55
    Object o = iter.next();
    56
    if ((o instanceof Top) && !(o instanceof Multi))
    56
    if ((o instanceof Top) && !(o instanceof Multi))
    57
    foundSimp = true;
    57
    foundSimp = true;
    58
    if (o instanceof Multi && !(o instanceof SubMulti))
    58
    if (o instanceof Multi && !(o instanceof SubMulti))
    59
    foundMulti = true;
    59
    foundMulti = true;
    60
    if (o instanceof SubMulti)
    60
    if (o instanceof SubMulti)
    61
    foundSubMulti = true;
    61
    foundSubMulti = true;
    62
    assertTrue(foundSimp && foundMulti && foundSubMulti);
    62
    assertTrue(foundSimp && foundMulti && foundSubMulti);
    63
    s.find("from Multi m where m.count>0 and m.extraProp is not null");
    63
    s.find("from Multi m where m.count>0 and m.extraProp is not null");
    64
    s.find("from Top m where m.count>0 and m.name is not null");
    64
    s.find("from Top m where m.count>0 and m.name is not null");
    65
    s.find("from Lower m where m.other is not null");
    65
    s.find("from Lower m where m.other is not null");
    66
    s.find("from Multi m where m.other.id = 1");
    66
    s.find("from Multi m where m.other.id = 1");
    67
    s.find("from SubMulti m where m.amount > 0.0");
    67
    s.find("from SubMulti m where m.amount > 0.0");
    68
    assertTrue(s.find("from Multi").size() == 2);
    68
    assertTrue(s.find("from Multi").size() == 2);
    69
    assertTrue(s.find("from Multi m where m.class = SubMulti").size() == 1);
    69
    assertTrue(s.find("from Multi m where m.class = SubMulti").size() == 1);
    69
    assertTrue(s.find("from Top").size() == 3);
    Differences
    Expression1Expression2Difference
    "from Multi m where m.class = SubMulti""from Top"LITERAL_VALUE_MISMATCH
    13LITERAL_VALUE_MISMATCH
    69
    assertTrue(s.find("from Top").size() == 3);
    70
    assertTrue(s.find("from Top m where m.class = Multi").size() == 1);
    70
    assertTrue(s.find("from Top m where m.class = Multi").size() == 1);
    70
    assertTrue(s.find("from Lower").size() == 0);
    Differences
    Expression1Expression2Difference
    "from Top m where m.class = Multi""from Lower"LITERAL_VALUE_MISMATCH
    10LITERAL_VALUE_MISMATCH
    70
    assertTrue(s.find("from Lower").size() == 0);
    71
    assertTrue(s.find("from Top").size() == 3);
    71
    assertTrue(s.find("from Top").size() == 3);
    71
    assertTrue(s.find("from SubMulti").size() == 1);
    Differences
    Expression1Expression2Difference
    "from Top""from SubMulti"LITERAL_VALUE_MISMATCH
    31LITERAL_VALUE_MISMATCH
    71
    assertTrue(s.find("from SubMulti").size() == 1);
    72
    assertTrue(s.find("from Lower").size() == 0);
    72
    assertTrue(s.find("from Lower").size() == 0);
    Preondition Violations
    Unmatched statement assertTrue(s.find("from Lower").size() == 0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
    73
    assertTrue(s.find("from SubMulti").size() == 1);
    73
    assertTrue(s.find("from SubMulti").size() == 1);
    Preondition Violations
    Unmatched statement assertTrue(s.find("from SubMulti").size() == 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                            
    74
    s.find("from Lower ls join ls.bag s where s.id is not null");
    74
    s.find("from Lower ls join ls.bag s where s.id is not null");
    Preondition Violations
    Unmatched statement s.find("from Lower ls join ls.bag s where s.id is not null"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                      
    75
    s.find("from Lower ls join ls.set s where s.id is not null");
    75
    s.find("from Lower ls join ls.set s where s.id is not null");
    72
    s.find("from Lower ls join ls.bag s where s.id is not null");
    Differences
    Expression1Expression2Difference
    "from Lower ls join ls.set s where s.id is not null""from Lower ls join ls.bag s where s.id is not null"LITERAL_VALUE_MISMATCH
    72
    s.find("from Lower ls join ls.bag s where s.id is not null");
    76
    if (!(getDialect() instanceof MySQLDialect))
    73
    if (!(getDialect() instanceof MySQLDialect))
    77
    s.find("from SubMulti sm where exists elements(sm.children)");
    74
    s.find("from SubMulti sm where exists elements(sm.children)");
    78
    List l = s.createCriteria(Top.class).list();
    78
    List l = s.createCriteria(Top.class).list();
    Preondition Violations
    Unmatched statement List l=s.createCriteria(Top.class).list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                
    79
    assertTrue(l.size() == 3);
                                                                
    80
    assertTrue(s.createCriteria(SubMulti.class).list().size() == 1);
    80
    assertTrue(s.createCriteria(SubMulti.class).list().size() == 1);
    Preondition Violations
    Unmatched statement assertTrue(s.createCriteria(SubMulti.class).list().size() == 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                            
    81
    assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.lt("amount", new Float(0))).list().size() == 0);
    81
    assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.lt("amount", new Float(0))).list().size() == 0);
    Preondition Violations
    Unmatched statement assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.lt("amount",new Float(0))).list().size() == 0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                                    
    82
    assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.ge("amount", new Float(0))).list().size() == 1);
    82
    assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.ge("amount", new Float(0))).list().size() == 1);
    Preondition Violations
    Unmatched statement assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.ge("amount",new Float(0))).list().size() == 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                                                                    
    83
    t.commit();
    75
    t.commit();
                                
    76
    s.close();
                                            
    77
    s = openSession();
    Preondition Violations
    Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    77
    s = openSession();
                                                          
    78
    t = s.beginTransaction();
    Preondition Violations
    Unmatched statement t=s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    78
    t = s.beginTransaction();
    84
    s.close();
    83
    s.close();
    85
    s = openSession();
    84
    s = openSession();
    86
    t = s.beginTransaction();
    85
    t = s.beginTransaction();
    87
    multi = (Multi)s.load(Top.class, mid, LockMode.UPGRADE);
    87
    multi = (Multi)s.load(Top.class, mid, LockMode.UPGRADE);
    79
    multi = (Multi)s.load(Top.class, multiId, LockMode.UPGRADE);
    Differences
    Expression1Expression2Difference
    midmultiIdVARIABLE_NAME_MISMATCH
    79
    multi = (Multi)s.load(Top.class, multiId, LockMode.UPGRADE);
    88
    simp = (Top)s.load(Top.class, sid);
    88
    simp = (Top)s.load(Top.class, sid);
    80
    simp = (Top)s.load(Top.class, simpId);
    Differences
    Expression1Expression2Difference
    sidsimpIdVARIABLE_NAME_MISMATCH
    80
    simp = (Top)s.load(Top.class, simpId);
    89
    s.lock(simp, LockMode.UPGRADE_NOWAIT);
    81
    s.lock(simp, LockMode.UPGRADE_NOWAIT);
    90
    t.commit();
    82
    t.commit();
    91
    s.close();
    90
    s.close();
    92
    s = openSession();
    84
    s = openSession();
    93
    t = s.beginTransaction();
    85
    t = s.beginTransaction();
    94
    s.update(multi, mid);
    94
    s.update(multi, mid);
    86
    s.update(multi, multiId);
    Differences
    Expression1Expression2Difference
    midmultiIdVARIABLE_NAME_MISMATCH
    86
    s.update(multi, multiId);
    95
    s.delete(multi);
    87
    s.delete(multi);
    96
    assertTrue(s.delete("from Top") == 2);
    88
    assertTrue(s.delete("from Top") == 2);
    97
    t.commit();
    89
    t.commit();
    98
    s.close();
    90
    s.close();
    Precondition Violations (9)
    Row Violation
    1Unmatched statement assertTrue(s.find("from Lower").size() == 0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement assertTrue(s.find("from SubMulti").size() == 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement s.find("from Lower ls join ls.bag s where s.id is not null"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement List l=s.createCriteria(Top.class).list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement assertTrue(s.createCriteria(SubMulti.class).list().size() == 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.lt("amount",new Float(0))).list().size() == 0); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement assertTrue(s.createCriteria(SubMulti.class).add(Restrictions.ge("amount",new Float(0))).list().size() == 1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9Unmatched statement t=s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted