public void testFilteredJoinedSubclassHqlDeleteRoot() { Session s = openSession(); s.beginTransaction(); s.save( new Employee( "John", 'M', "john", new Date() ) ); s.save( new Employee( "Jane", 'F', "jane", new Date() ) ); s.save( new Customer( "Charlie", 'M', "charlie", "Acme" ) ); s.save( new Customer( "Wanda", 'F', "wanda", "ABC" ) ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); s.enableFilter( "sex" ).setParameter( "sexCode", new Character('M' ) ); int count = s.createQuery( "delete Person" ).executeUpdate(); assertEquals( 2, count ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); s.createQuery( "delete Person" ).executeUpdate(); s.getTransaction().commit(); s.close();
public void testFilteredJoinedSubclassHqlUpdateLeaf() { Session s = openSession(); s.beginTransaction(); s.save( new Employee( "John", 'M', "john", new Date() ) ); s.save( new Employee( "Jane", 'F', "jane", new Date() ) ); s.save( new Customer( "Charlie", 'M', "charlie", "Acme" ) ); s.save( new Customer( "Wanda", 'F', "wanda", "ABC" ) ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); s.enableFilter( "sex" ).setParameter( "sexCode", new Character('M' ) ); int count = s.createQuery( "update Customer c set c.company = 'XYZ'" ).executeUpdate(); assertEquals( 1, count ); s.getTransaction().commit(); s.close(); s = openSession(); s.beginTransaction(); s.createQuery( "delete Person" ).executeUpdate(); s.getTransaction().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/filter/hql/JoinedFilteredBulkManipulationTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/filter/hql/JoinedFilteredBulkManipulationTest.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public void testFilteredJoinedSubclassHqlDeleteRoot() {
1
public void testFilteredJoinedSubclassHqlUpdateLeaf() {
2
		Session s = openSession();
2
		Session s = openSession();
3
		s.beginTransaction();
3
		s.beginTransaction();
4
		s.save( new Employee( "John", 'M', "john", new Date() ) );
4
		s.save( new Employee( "John", 'M', "john", new Date() ) );
5
		s.save( new Employee( "Jane", 'F', "jane", new Date() ) );
5
		s.save( new Employee( "Jane", 'F', "jane", new Date() ) );
6
		s.save( new Customer( "Charlie", 'M', "charlie", "Acme" ) );
6
		s.save( new Customer( "Charlie", 'M', "charlie", "Acme" ) );
7
		s.save( new Customer( "Wanda", 'F', "wanda", "ABC" ) );
7
		s.save( new Customer( "Wanda", 'F', "wanda", "ABC" ) );
8
		s.getTransaction().commit();
8
		s.getTransaction().commit();
9
		s.close();
9
		s.close();
10
		s = openSession();
10
		s = openSession();
11
		s.beginTransaction();
11
		s.beginTransaction();
12
		s.enableFilter( "sex" ).setParameter( "sexCode", new Character('M' ) );
12
		s.enableFilter( "sex" ).setParameter( "sexCode", new Character('M' ) );
13
		int count = s.createQuery( "delete Person" ).executeUpdate();
13
		int count = s.createQuery( "update Customer c set c.company = 'XYZ'" ).executeUpdate();
14
		assertEquals( 2, count );
14
		assertEquals( 1, count );
15
		s.getTransaction().commit();
15
		s.getTransaction().commit();
16
		s.close();
16
		s.close();
17
		s = openSession();
17
		s = openSession();
18
		s.beginTransaction();
18
		s.beginTransaction();
19
		s.createQuery( "delete Person" ).executeUpdate();
19
		s.createQuery( "delete Person" ).executeUpdate();
20
		s.getTransaction().commit();
20
		s.getTransaction().commit();
21
		s.close();
21
		s.close();
22
	
22
	
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0