Session s = openSession(); Transaction t = s.beginTransaction(); Employee mark = new Employee(); mark.setName("Mark"); mark.setTitle("internal sales"); mark.setSex('M'); mark.setAddress("buckhead"); mark.setZip("30305"); mark.setCountry("USA"); Customer joe = new Customer(); joe.setName("Joe"); joe.setAddress("San Francisco"); joe.setZip("XXXXX"); joe.setCountry("USA"); joe.setComments("Very demanding"); joe.setSex('M'); joe.setSalesperson(mark); Person yomomma = new Person(); yomomma.setName("mum"); yomomma.setSex('F'); s.save(yomomma); s.save(mark); s.save(joe); assertEquals( s.createQuery("from java.io.Serializable").list().size(), 0 ); assertEquals( s.createQuery("from Person").list().size(), 3 ); assertEquals( s.createQuery("from Person p where p.class = Customer").list().size(), 1 ); assertEquals( s.createQuery("from Person p where p.class = Person").list().size(), 1 ); s.clear(); List customers = s.createQuery("from Customer c left join fetch c.salesperson").list(); for ( Iterator iter = customers.iterator(); iter.hasNext(); ) { Customer c = (Customer) iter.next(); assertTrue( Hibernate.isInitialized( c.getSalesperson() ) ); assertEquals( c.getSalesperson().getName(), "Mark" ); } assertEquals( customers.size(), 1 ); s.clear(); customers = s.createQuery("from Customer").list(); for ( Iterator iter = customers.iterator(); iter.hasNext(); ) { Customer c = (Customer) iter.next(); assertFalse( Hibernate.isInitialized( c.getSalesperson() ) ); assertEquals( c.getSalesperson().getName(), "Mark" ); } assertEquals( customers.size(), 1 ); s.clear(); mark = (Employee) s.get( Employee.class, new Long( mark.getId() ) ); joe = (Customer) s.get( Customer.class, new Long( joe.getId() ) ); mark.setZip("30306"); assertEquals( s.createQuery("from Person p where p.address.zip = '30306'").list().size(), 1 ); if ( supportsRowValueConstructorSyntaxInInList() ) { s.createCriteria(Person.class).add( Restrictions.in("address", new Address[] { mark.getAddress(), joe.getAddress() } ) ).list(); } s.delete(mark); s.delete(joe); s.delete(yomomma); assertTrue( s.createQuery("from Person").list().isEmpty() ); t.commit(); s.close();
Session s = openSession(); Transaction t = s.beginTransaction(); Employee mark = new Employee(); mark.setName("Mark"); mark.setTitle("internal sales"); mark.setSex('M'); mark.setAddress("buckhead"); mark.setZip("30305"); mark.setCountry("USA"); Customer joe = new Customer(); joe.setName("Joe"); joe.setAddress("San Francisco"); joe.setZip("XXXXX"); joe.setCountry("USA"); joe.setComments("Very demanding"); joe.setSex('M'); joe.setSalesperson(mark); Person yomomma = new Person(); yomomma.setName("mum"); yomomma.setSex('F'); s.save(yomomma); s.save(mark); s.save(joe); assertEquals( s.createQuery("from java.io.Serializable").list().size(), 0 ); assertEquals( s.createQuery("from Person").list().size(), 3 ); assertEquals( s.createQuery("from Person p where p.class = Customer").list().size(), 1 ); assertEquals( s.createQuery("from Person p where p.class = Person").list().size(), 1 ); s.clear(); List customers = s.createQuery("from Customer c left join fetch c.salesperson").list(); for ( Iterator iter = customers.iterator(); iter.hasNext(); ) { Customer c = (Customer) iter.next(); assertTrue( Hibernate.isInitialized( c.getSalesperson() ) ); assertEquals( c.getSalesperson().getName(), "Mark" ); } assertEquals( customers.size(), 1 ); s.clear(); customers = s.createQuery("from Customer").list(); for ( Iterator iter = customers.iterator(); iter.hasNext(); ) { Customer c = (Customer) iter.next(); assertFalse( Hibernate.isInitialized( c.getSalesperson() ) ); assertEquals( c.getSalesperson().getName(), "Mark" ); } assertEquals( customers.size(), 1 ); s.clear(); mark = (Employee) s.get( Employee.class, new Long( mark.getId() ) ); joe = (Customer) s.get( Customer.class, new Long( joe.getId() ) ); mark.setZip("30306"); assertEquals( s.createQuery("from Person p where p.address.zip = '30306'").list().size(), 1 ); if ( supportsRowValueConstructorSyntaxInInList() ) { s.createCriteria(Person.class).add( Restrictions.in("address", new Address[] { mark.getAddress(), joe.getAddress() } ) ).list(); } s.delete(mark); s.delete(joe); s.delete(yomomma); assertTrue( s.createQuery("from Person").list().isEmpty() ); 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/joinedsubclass/JoinedSubclassTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/unionsubclass2/UnionSubclassTest.java
Method name: void testJoinedSubclass() Method name: void testUnionSubclass()
Number of AST nodes: 54 Number of AST nodes: 54
1
Session s = openSession();
1
Session s = openSession();
2
		Transaction t = s.beginTransaction();
2
		Transaction t = s.beginTransaction();
3
		
3
		Employee mark = new Employee();
4
		Employee mark = new Employee();
4
		mark.setName("Mark");
5
		mark.setName("Mark");
5
		mark.setTitle("internal sales");
6
		mark.setTitle("internal sales");
6
		mark.setSex('M');
7
		mark.setSex('M');
7
		mark.setAddress("buckhead");
8
		mark.setAddress("buckhead");
8
		mark.setZip("30305");
9
		mark.setZip("30305");
9
		mark.setCountry("USA");
10
		mark.setCountry("USA");
11
		
10
		Customer joe = new Customer();
12
		Customer joe = new Customer();
11
		joe.setName("Joe");
13
		joe.setName("Joe");
12
		joe.setAddress("San Francisco");
14
		joe.setAddress("San Francisco");
13
		joe.setZip("XXXXX");
15
		joe.setZip("XXXXX");
14
		joe.setCountry("USA");
16
		joe.setCountry("USA");
15
		joe.setComments("Very demanding");
17
		joe.setComments("Very demanding");
16
		joe.setSex('M');
18
		joe.setSex('M');
17
		joe.setSalesperson(mark);
19
		joe.setSalesperson(mark);
20
		
18
		Person yomomma = new Person();
21
		Person yomomma = new Person();
19
		yomomma.setName("mum");
22
		yomomma.setName("mum");
20
		yomomma.setSex('F');
23
		yomomma.setSex('F');
24
		
21
		s.save(yomomma);
25
		s.save(yomomma);
22
		s.save(mark);
26
		s.save(mark);
23
		s.save(joe);
27
		s.save(joe);
28
		
24
		assertEquals( s.createQuery("from java.io.Serializable").list().size(), 0 );
29
		assertEquals( s.createQuery("from java.io.Serializable").list().size(), 0 );
30
		
25
		assertEquals( s.createQuery("from Person").list().size(), 3 );
31
		assertEquals( s.createQuery("from Person").list().size(), 3 );
26
		assertEquals( s.createQuery("from Person p where p.class = Customer").list().size(), 1 );
32
		assertEquals( s.createQuery("from Person p where p.class = Customer").list().size(), 1 );
27
		assertEquals( s.createQuery("from Person p where p.class = Person").list().size(), 1 );
33
		assertEquals( s.createQuery("from Person p where p.class = Person").list().size(), 1 );
28
		s.clear();
34
		s.clear();
29
		List customers = s.createQuery("from Customer c left join fetch c.salesperson").list();
35
		List customers = s.createQuery("from Customer c left join fetch c.salesperson").list();
30
		for ( Iterator iter = customers.iterator(); iter.hasNext(); ) {
36
		for ( Iterator iter = customers.iterator(); iter.hasNext(); ) {
31
			Customer c = (Customer) iter.next();
37
			Customer c = (Customer) iter.next();
32
			assertTrue( Hibernate.isInitialized( c.getSalesperson() ) );
38
			assertTrue( Hibernate.isInitialized( c.getSalesperson() ) );
33
			assertEquals( c.getSalesperson().getName(), "Mark" );
39
			assertEquals( c.getSalesperson().getName(), "Mark" );
34
		}
40
		}
35
		assertEquals( customers.size(), 1 );
41
		assertEquals( customers.size(), 1 );
36
		s.clear();
42
		s.clear();
43
		
37
		customers = s.createQuery("from Customer").list();
44
		customers = s.createQuery("from Customer").list();
38
		for ( Iterator iter = customers.iterator(); iter.hasNext(); ) {
45
		for ( Iterator iter = customers.iterator(); iter.hasNext(); ) {
39
			Customer c = (Customer) iter.next();
46
			Customer c = (Customer) iter.next();
40
			assertFalse( Hibernate.isInitialized( c.getSalesperson() ) );
47
			assertFalse( Hibernate.isInitialized( c.getSalesperson() ) );
41
			assertEquals( c.getSalesperson().getName(), "Mark" );
48
			assertEquals( c.getSalesperson().getName(), "Mark" );
42
		}
49
		}
43
		assertEquals( customers.size(), 1 );
50
		assertEquals( customers.size(), 1 );
44
		s.clear();
51
		s.clear();
52
		
45
		mark = (Employee) s.get( Employee.class, new Long( mark.getId() ) );
53
		mark = (Employee) s.get( Employee.class, new Long( mark.getId() ) );
46
		joe = (Customer) s.get( Customer.class, new Long( joe.getId() ) );
54
		joe = (Customer) s.get( Customer.class, new Long( joe.getId() ) );
55
		
47
 		mark.setZip("30306");
56
 		mark.setZip("30306");
48
		assertEquals( s.createQuery("from Person p where p.address.zip = '30306'").list().size(), 1 );
57
		assertEquals( s.createQuery("from Person p where p.address.zip = '30306'").list().size(), 1 );
49
		if ( supportsRowValueConstructorSyntaxInInList() ) {
58
		if ( supportsRowValueConstructorSyntaxInInList() ) {
50
			s.createCriteria(Person.class).add(
59
			s.createCriteria(Person.class).add( 
51
					Restrictions.in("address", new Address[] { mark.getAddress(), joe.getAddress() } )
60
					Restrictions.in("address", new Address[] { mark.getAddress(), joe.getAddress() } ) 
52
			).list();
61
			).list();
53
		}
62
		}
63
		
54
		s.delete(mark);
64
		s.delete(mark);
55
		s.delete(joe);
65
		s.delete(joe);
56
		s.delete(yomomma);
66
		s.delete(yomomma);
57
		assertTrue( s.createQuery("from Person").list().isEmpty() );
67
		assertTrue( s.createQuery("from Person").list().isEmpty() );
58
		t.commit();
68
		t.commit();
59
		s.close();
69
		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)1.5
Clones locationClones are in different classes having the same super class
Number of node comparisons954
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements46
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment8
    Time elapsed for statement mapping (ms)151.1
    Clone typeType 2
    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
    Employee mark = new Employee();
    3
    Employee mark = new Employee();
                                                                    
    4
    mark.setName("Mark");
    4
    mark.setName("Mark");
    4
    mark.setName("Mark");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    4
    mark.setName("Mark");
    5
    mark.setTitle("internal sales");
    5
    mark.setTitle("internal sales");
    5
    mark.setTitle("internal sales");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    5
    mark.setTitle("internal sales");
    6
    mark.setSex('M');
    6
    mark.setSex('M');
    6
    mark.setSex('M');
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    6
    mark.setSex('M');
    7
    mark.setAddress("buckhead");
    7
    mark.setAddress("buckhead");
    7
    mark.setAddress("buckhead");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    7
    mark.setAddress("buckhead");
    8
    mark.setZip("30305");
    8
    mark.setZip("30305");
    8
    mark.setZip("30305");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    8
    mark.setZip("30305");
    9
    mark.setCountry("USA");
    9
    mark.setCountry("USA");
    9
    mark.setCountry("USA");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    9
    mark.setCountry("USA");
                                                                    
    10
    Customer joe = new Customer();
    10
    Customer joe = new Customer();
                                                                    
    11
    joe.setName("Joe");
    11
    joe.setName("Joe");
    11
    joe.setName("Joe");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    11
    joe.setName("Joe");
    12
    joe.setAddress("San Francisco");
    12
    joe.setAddress("San Francisco");
    12
    joe.setAddress("San Francisco");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    12
    joe.setAddress("San Francisco");
    13
    joe.setZip("XXXXX");
    13
    joe.setZip("XXXXX");
    13
    joe.setZip("XXXXX");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    13
    joe.setZip("XXXXX");
    14
    joe.setCountry("USA");
    14
    joe.setCountry("USA");
    14
    joe.setCountry("USA");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    14
    joe.setCountry("USA");
    15
    joe.setComments("Very demanding");
    15
    joe.setComments("Very demanding");
    15
    joe.setComments("Very demanding");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    15
    joe.setComments("Very demanding");
    16
    joe.setSex('M');
    16
    joe.setSex('M');
    16
    joe.setSex('M');
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    16
    joe.setSex('M');
    17
    joe.setSalesperson(mark);
    17
    joe.setSalesperson(mark);
    17
    joe.setSalesperson(mark);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    17
    joe.setSalesperson(mark);
                                                                    
    18
    Person yomomma = new Person();
    18
    Person yomomma = new Person();
                                                                    
    19
    yomomma.setName("mum");
    19
    yomomma.setName("mum");
    19
    yomomma.setName("mum");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Personorg.hibernate.test.unionsubclass2.PersonVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    • Make classes org.hibernate.test.joinedsubclass.Person and org.hibernate.test.unionsubclass2.Person extend a common superclass
    19
    yomomma.setName("mum");
    20
    yomomma.setSex('F');
    20
    yomomma.setSex('F');
    20
    yomomma.setSex('F');
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Personorg.hibernate.test.unionsubclass2.PersonVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    • Make classes org.hibernate.test.joinedsubclass.Person and org.hibernate.test.unionsubclass2.Person extend a common superclass
    20
    yomomma.setSex('F');
    21
    s.save(yomomma);
    21
    s.save(yomomma);
    21
    s.save(yomomma);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Personorg.hibernate.test.unionsubclass2.PersonVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    • Make classes org.hibernate.test.joinedsubclass.Person and org.hibernate.test.unionsubclass2.Person extend a common superclass
    21
    s.save(yomomma);
    22
    s.save(mark);
    22
    s.save(mark);
    22
    s.save(mark);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    22
    s.save(mark);
    23
    s.save(joe);
    23
    s.save(joe);
    23
    s.save(joe);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    23
    s.save(joe);
    24
    assertEquals(s.createQuery("from java.io.Serializable").list().size(), 0);
    24
    assertEquals(s.createQuery("from java.io.Serializable").list().size(), 0);
    25
    assertEquals(s.createQuery("from Person").list().size(), 3);
    25
    assertEquals(s.createQuery("from Person").list().size(), 3);
    26
    assertEquals(s.createQuery("from Person p where p.class = Customer").list().size(), 1);
    26
    assertEquals(s.createQuery("from Person p where p.class = Customer").list().size(), 1);
    27
    assertEquals(s.createQuery("from Person p where p.class = Person").list().size(), 1);
    27
    assertEquals(s.createQuery("from Person p where p.class = Person").list().size(), 1);
    28
    s.clear();
    28
    s.clear();
    29
    List customers = s.createQuery("from Customer c left join fetch c.salesperson").list();
    29
    List customers = s.createQuery("from Customer c left join fetch c.salesperson").list();
    30
    for (Iterator iter = customers.iterator(); iter.hasNext(); )
    30
    for (Iterator iter = customers.iterator(); iter.hasNext(); )
                                                                              
    31
    Customer c = (Customer)iter.next();
    Preondition Violations
    Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    31
    Customer c = (Customer)iter.next();
    31
    Customer c = (Customer)iter.next();
    31
    Customer c = (Customer)iter.next();
    Preondition Violations
    Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                              
    32
    assertTrue(Hibernate.isInitialized(c.getSalesperson()));
    32
    assertTrue(Hibernate.isInitialized(c.getSalesperson()));
    32
    assertTrue(Hibernate.isInitialized(c.getSalesperson()));
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    32
    assertTrue(Hibernate.isInitialized(c.getSalesperson()));
    33
    assertEquals(c.getSalesperson().getName(), "Mark");
    33
    assertEquals(c.getSalesperson().getName(), "Mark");
    33
    assertEquals(c.getSalesperson().getName(), "Mark");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    33
    assertEquals(c.getSalesperson().getName(), "Mark");
    34
    assertEquals(customers.size(), 1);
    34
    assertEquals(customers.size(), 1);
    35
    s.clear();
    35
    s.clear();
    36
    customers = s.createQuery("from Customer").list();
    36
    customers = s.createQuery("from Customer").list();
    37
    for (Iterator iter = customers.iterator(); iter.hasNext(); )
    37
    for (Iterator iter = customers.iterator(); iter.hasNext(); )
                                                                              
    38
    Customer c = (Customer)iter.next();
    Preondition Violations
    Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    38
    Customer c = (Customer)iter.next();
    38
    Customer c = (Customer)iter.next();
    38
    Customer c = (Customer)iter.next();
    Preondition Violations
    Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                              
    39
    assertFalse(Hibernate.isInitialized(c.getSalesperson()));
    39
    assertFalse(Hibernate.isInitialized(c.getSalesperson()));
    39
    assertFalse(Hibernate.isInitialized(c.getSalesperson()));
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    39
    assertFalse(Hibernate.isInitialized(c.getSalesperson()));
    40
    assertEquals(c.getSalesperson().getName(), "Mark");
    40
    assertEquals(c.getSalesperson().getName(), "Mark");
    40
    assertEquals(c.getSalesperson().getName(), "Mark");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    40
    assertEquals(c.getSalesperson().getName(), "Mark");
    41
    assertEquals(customers.size(), 1);
    41
    assertEquals(customers.size(), 1);
    42
    s.clear();
    42
    s.clear();
                                                                                                                                    
    43
    mark = (Employee)s.get(Employee.class, new Long(mark.getId()));
    Preondition Violations
    Unmatched statement mark=(Employee)s.get(Employee.class,new Long(mark.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    43
    mark = (Employee)s.get(Employee.class, new Long(mark.getId()));
    43
    mark = (Employee)s.get(Employee.class, new Long(mark.getId()));
    43
    mark = (Employee)s.get(Employee.class, new Long(mark.getId()));
    Preondition Violations
    Unmatched statement mark=(Employee)s.get(Employee.class,new Long(mark.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                    
                                                                                                                                
    44
    joe = (Customer)s.get(Customer.class, new Long(joe.getId()));
    Preondition Violations
    Unmatched statement joe=(Customer)s.get(Customer.class,new Long(joe.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    44
    joe = (Customer)s.get(Customer.class, new Long(joe.getId()));
    44
    joe = (Customer)s.get(Customer.class, new Long(joe.getId()));
    44
    joe = (Customer)s.get(Customer.class, new Long(joe.getId()));
    Preondition Violations
    Unmatched statement joe=(Customer)s.get(Customer.class,new Long(joe.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                
    45
    mark.setZip("30306");
    45
    mark.setZip("30306");
    45
    mark.setZip("30306");
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    45
    mark.setZip("30306");
    46
    assertEquals(s.createQuery("from Person p where p.address.zip = '30306'").list().size(), 1);
    46
    assertEquals(s.createQuery("from Person p where p.address.zip = '30306'").list().size(), 1);
    47
    if (supportsRowValueConstructorSyntaxInInList())
    47
    if (supportsRowValueConstructorSyntaxInInList())
                                                                                                                                                                                                                                                            
    48
    s.createCriteria(Person.class).add(Restrictions.in("address", new Address[] {mark.getAddress(), joe.getAddress()})).list();
    Preondition Violations
    Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    48
    s.createCriteria(Person.class).add(Restrictions.in("address", new Address[] {mark.getAddress(), joe.getAddress()})).list();
    48
    s.createCriteria(Person.class).add(Restrictions.in("address", new Address[] {mark.getAddress(), joe.getAddress()})).list();
    48
    s.createCriteria(Person.class).add(Restrictions.in("address", new Address[] {mark.getAddress(), joe.getAddress()})).list();
    Preondition Violations
    Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                                                                                                                                            
    49
    s.delete(mark);
    49
    s.delete(mark);
    49
    s.delete(mark);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Employeeorg.hibernate.test.unionsubclass2.EmployeeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    • Make classes org.hibernate.test.joinedsubclass.Employee and org.hibernate.test.unionsubclass2.Employee extend a common superclass
    49
    s.delete(mark);
    50
    s.delete(joe);
    50
    s.delete(joe);
    50
    s.delete(joe);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Customerorg.hibernate.test.unionsubclass2.CustomerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    • Make classes org.hibernate.test.joinedsubclass.Customer and org.hibernate.test.unionsubclass2.Customer extend a common superclass
    50
    s.delete(joe);
    51
    s.delete(yomomma);
    51
    s.delete(yomomma);
    51
    s.delete(yomomma);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.joinedsubclass.Personorg.hibernate.test.unionsubclass2.PersonVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    • Make classes org.hibernate.test.joinedsubclass.Person and org.hibernate.test.unionsubclass2.Person extend a common superclass
    51
    s.delete(yomomma);
    52
    assertTrue(s.createQuery("from Person").list().isEmpty());
    52
    assertTrue(s.createQuery("from Person").list().isEmpty());
    53
    t.commit();
    53
    t.commit();
    54
    s.close();
    54
    s.close();
    Precondition Violations (51)
    Row Violation
    1Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    2Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    3Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    4Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    5Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    6Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    7Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    8Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    9Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    10Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    11Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    12Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    13Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    14Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    15Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    16Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    17Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma
    18Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    19Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    20Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    21Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    23Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    25Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    26Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    29Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    30Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    31Unmatched statement Customer c=(Customer)iter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    32Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    33Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    34Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    35Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    36Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    37Expression c.getSalesperson() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    38Type org.hibernate.test.joinedsubclass.Employee of variable c.getSalesperson() does not match with type org.hibernate.test.unionsubclass2.Employee of variable c.getSalesperson()
    39Type org.hibernate.test.joinedsubclass.Customer of variable c does not match with type org.hibernate.test.unionsubclass2.Customer of variable c
    40Unmatched statement mark=(Employee)s.get(Employee.class,new Long(mark.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    41Unmatched statement mark=(Employee)s.get(Employee.class,new Long(mark.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    42Unmatched statement joe=(Customer)s.get(Customer.class,new Long(joe.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    43Unmatched statement joe=(Customer)s.get(Customer.class,new Long(joe.getId())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    44Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    45Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    46Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    47Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    48Unmatched statement s.createCriteria(Person.class).add(Restrictions.in("address",new Address[]{mark.getAddress(),joe.getAddress()})).list(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    49Type org.hibernate.test.joinedsubclass.Employee of variable mark does not match with type org.hibernate.test.unionsubclass2.Employee of variable mark
    50Type org.hibernate.test.joinedsubclass.Customer of variable joe does not match with type org.hibernate.test.unionsubclass2.Customer of variable joe
    51Type org.hibernate.test.joinedsubclass.Person of variable yomomma does not match with type org.hibernate.test.unionsubclass2.Person of variable yomomma