if ( collection.needsInserting( entry, i, elementType ) ) { if ( useBatch ) { if ( st == null ) { if ( callable ) { st = session.getBatcher().prepareBatchCallableStatement( sql ); } else { st = session.getBatcher().prepareBatchStatement( sql ); } } } else { if ( callable ) { st = session.getBatcher().prepareCallableStatement( sql ); } else { st = session.getBatcher().prepareStatement( sql ); } } try { offset += expectation.prepare( st ); //TODO: copy/paste from recreate() offset = writeKey( st, id, offset, session ); if ( hasIdentifier ) { offset = writeIdentifier( st, collection.getIdentifier(entry, i), offset, session ); } if ( hasIndex /*&& !indexIsFormula*/ ) { offset = writeIndex( st, collection.getIndex(entry, i, this), offset, session ); } writeElement(st, collection.getElement(entry), offset, session ); if ( useBatch ) { session.getBatcher().addToBatch( expectation ); } else { expectation.verifyOutcome( st.executeUpdate(), st, -1 ); } collection.afterRowInsert( this, entry, i ); count++; } catch ( SQLException sqle ) { if ( useBatch ) { session.getBatcher().abortBatch( sqle ); } throw sqle; } finally { if ( !useBatch ) { session.getBatcher().closeStatement( st );
int offset = 1; if ( useBatch ) { if ( st == null ) { if ( callable ) { st = session.getBatcher().prepareBatchCallableStatement( sql ); } else { st = session.getBatcher().prepareBatchStatement( sql ); } } } else { if ( callable ) { st = session.getBatcher().prepareCallableStatement( sql ); } else { st = session.getBatcher().prepareStatement( sql ); } } try { offset+= expectation.prepare( st ); int loc = writeElement( st, collection.getElement( entry ), offset, session ); if ( hasIdentifier ) { writeIdentifier( st, collection.getIdentifier( entry, i ), loc, session ); } else { loc = writeKey( st, id, loc, session ); if ( hasIndex && !indexContainsFormula ) { writeIndexToWhere( st, collection.getIndex( entry, i, this ), loc, session ); } else { writeElementToWhere( st, collection.getSnapshotElement( entry, i ), loc, session ); } } if ( useBatch ) { session.getBatcher().addToBatch( expectation ); } else { expectation.verifyOutcome( st.executeUpdate(), st, -1 ); } } catch ( SQLException sqle ) { if ( useBatch ) { session.getBatcher().abortBatch( sqle ); } throw sqle; } finally { if ( !useBatch ) { session.getBatcher().closeStatement( st ); } } count++;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/BasicCollectionPersister.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
if ( collection.needsInserting( entry, i, elementType ) ) {
1
int offset = 1;
2
						if ( useBatch ) {
2
					if ( useBatch ) {
3
							if ( st == null ) {
3
						if ( st == null ) {
4
								if ( callable ) {
4
							if ( callable ) {
5
									st = session.getBatcher().prepareBatchCallableStatement( sql );
5
								st = session.getBatcher().prepareBatchCallableStatement( sql );
6
								}
6
							}
7
								else {
7
							else {
8
									st = session.getBatcher().prepareBatchStatement( sql );
8
								st = session.getBatcher().prepareBatchStatement( sql );
9
								}
9
							}
10
							}
10
						}
11
						}
11
					}
12
						else {
12
					else {
13
							if ( callable ) {
13
						if ( callable ) {
14
								st = session.getBatcher().prepareCallableStatement( sql );
14
							st = session.getBatcher().prepareCallableStatement( sql );
15
							}
15
						}
16
							else {
16
						else {
17
								st = session.getBatcher().prepareStatement( sql );
17
							st = session.getBatcher().prepareStatement( sql );
18
							}
18
						}
19
						}
19
					}
20
						try {
20
					try {
21
							offset += expectation.prepare( st );
21
						offset+= expectation.prepare( st );
22
							//TODO: copy/paste from recreate()
22
						
23
							offset = writeKey( st, id, offset, session );
23
int loc = writeElement( st, collection.getElement( entry ), offset, session );
24
							if ( hasIdentifier ) {
24
						if ( hasIdentifier ) {
25
								offset = writeIdentifier( st, collection.getIdentifier(entry, i), offset, session );
25
							writeIdentifier( st, collection.getIdentifier( entry, i ), loc, session );
26
							}
26
						}
27
						else {
28
							loc = writeKey( st, id, loc, session );
27
							if ( hasIndex /*&& !indexIsFormula*/ ) {
29
							if ( hasIndex && !indexContainsFormula ) {
28
								offset = writeIndex( st, collection.getIndex(entry, i, this), offset, session );
30
								writeIndexToWhere( st, collection.getIndex( entry, i, this ), loc, session );
29
							}
31
							}
30
							
32
							else {
31
writeElement(st, collection.getElement(entry), offset, session );
33
								writeElementToWhere( st, collection.getSnapshotElement( entry, i ), loc, session );
32
	
34
							}
35
						}
33
						if ( useBatch ) {
36
						if ( useBatch ) {
34
								session.getBatcher().addToBatch( expectation );
37
							session.getBatcher().addToBatch( expectation );
35
							}
38
						}
36
							else {
39
						else {
37
								expectation.verifyOutcome( st.executeUpdate(), st, -1 );
40
							expectation.verifyOutcome( st.executeUpdate(), st, -1 );
38
							}
41
						}
39
							collection.afterRowInsert( this, entry, i );
42
					
40
							count++;
41
						}
43
}
42
						catch ( SQLException sqle ) {
44
					catch ( SQLException sqle ) {
43
							if ( useBatch ) {
45
						if ( useBatch ) {
44
								session.getBatcher().abortBatch( sqle );
46
							session.getBatcher().abortBatch( sqle );
45
							}
47
						}
46
							throw sqle;
48
						throw sqle;
47
						}
49
					}
48
						finally {
50
					finally {
49
							if ( !useBatch ) {
51
						if ( !useBatch ) {
50
								session.getBatcher().closeStatement( st );
52
							session.getBatcher().closeStatement( st );
51
						
53
						}
54
					}
55
					count++;
52
	
56
				
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