Fee fee = new Fee(); Fee fee2 = new Fee(); fee2.setAnotherFee(fee); Session s = openSession(); Transaction tx = s.beginTransaction(); s.save(fee); s.save(fee2); s.flush(); fee.setCount(123); tx.commit(); s.close(); s = openSession(); tx = s.beginTransaction(); s.update(fee); //fee2.setAnotherFee(null); s.update(fee2); s.delete(fee); s.delete(fee2); tx.commit(); s.close(); s = openSession(); tx = s.beginTransaction(); assertTrue( s.find("from Fee fee").size()==0 ); tx.commit(); s.close();
Fee fee = new Fee(); Fee fee2 = new Fee(); fee2.setAnotherFee(fee); Session s = openSession(); Transaction tx = s.beginTransaction(); s.save(fee); s.save(fee2); s.flush(); fee.setCount(123); tx.commit(); s.close(); s = openSession(); tx = s.beginTransaction(); s.delete(fee); s.delete(fee2); //foo.setAnotherFee(null); tx.commit(); s.close(); s = openSession(); tx = s.beginTransaction(); assertTrue( s.find("from Fee fee").size()==0 ); tx.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/FooBarTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java
Method name: void testDeleteUpdatedTransient() Method name: void testDeleteTransient()
Number of AST nodes: 24 Number of AST nodes: 22
1
Fee fee = new Fee();
1
Fee fee = new Fee();
2
		Fee fee2 = new Fee();
2
		Fee fee2 = new Fee();
3
		fee2.setAnotherFee(fee);
3
		fee2.setAnotherFee(fee);
4
		Session s = openSession();
4
		Session s = openSession();
5
		Transaction tx = s.beginTransaction();
5
		Transaction tx = s.beginTransaction();
6
		s.save(fee);
6
		s.save(fee);
7
		s.save(fee2);
7
		s.save(fee2);
8
		s.flush();
8
		s.flush();
9
		fee.setCount(123);
9
		fee.setCount(123);
10
		tx.commit();
10
		tx.commit();
11
		s.close();
11
		s.close();
12
		s = openSession();
12
		s = openSession();
13
		tx = s.beginTransaction();
13
		tx = s.beginTransaction();
14
		s.update(fee);
14
		s.
15
		//fee2.setAnotherFee(null);
16
		s.update(fee2);
15
delete(fee);
17
		s.delete(fee);
16
		s.delete(fee2);
18
		s.delete(fee2);
17
		//foo.setAnotherFee(null);
19
		tx.commit();
18
		tx.commit();
20
		s.close();
19
		s.close();
21
		s = openSession();
20
		s = openSession();
22
		tx = s.beginTransaction();
21
		tx = s.beginTransaction();
23
		assertTrue( s.find("from Fee fee").size()==0 );
22
		assertTrue( s.find("from Fee fee").size()==0 );
24
		tx.commit();
23
		tx.commit();
25
		s.close();
24
		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)0.0
Clones locationClones are declared in the same class
Number of node comparisons116
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements22
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    Fee fee = new Fee();
    1
    Fee fee = new Fee();
    2
    Fee fee2 = new Fee();
    2
    Fee fee2 = new Fee();
    3
    fee2.setAnotherFee(fee);
    3
    fee2.setAnotherFee(fee);
    4
    Session s = openSession();
    4
    Session s = openSession();
    5
    Transaction tx = s.beginTransaction();
    5
    Transaction tx = s.beginTransaction();
    6
    s.save(fee);
    6
    s.save(fee);
    7
    s.save(fee2);
    7
    s.save(fee2);
    8
    s.flush();
    8
    s.flush();
    9
    fee.setCount(123);
    9
    fee.setCount(123);
    10
    tx.commit();
    10
    tx.commit();
    11
    s.close();
    11
    s.close();
    12
    s = openSession();
    12
    s = openSession();
    13
    tx = s.beginTransaction();
    13
    tx = s.beginTransaction();
    14
    s.update(fee);
    14
    s.update(fee);
    Preondition Violations
    Unmatched statement s.update(fee); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                        
    15
    s.update(fee2);
    15
    s.update(fee2);
    Preondition Violations
    Unmatched statement s.update(fee2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    16
    s.delete(fee);
    14
    s.delete(fee);
    17
    s.delete(fee2);
    15
    s.delete(fee2);
    18
    tx.commit();
    16
    tx.commit();
    19
    s.close();
    17
    s.close();
    20
    s = openSession();
    18
    s = openSession();
    21
    tx = s.beginTransaction();
    19
    tx = s.beginTransaction();
    22
    assertTrue(s.find("from Fee fee").size() == 0);
    20
    assertTrue(s.find("from Fee fee").size() == 0);
    23
    tx.commit();
    21
    tx.commit();
    24
    s.close();
    22
    s.close();
    Precondition Violations (3)
    Row Violation
    1Unmatched statement s.update(fee); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement s.update(fee2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Clone fragment #1 returns variables fee, s, fee2 , while Clone fragment #2 returns variables