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/AbstractCollectionPersister.java | |||
Method name: void recreate(PersistentCollection, Serializable, SessionImplementor)
|
Method name: void insertRows(PersistentCollection, Serializable, SessionImplementor)
|
|||
Number of AST nodes: 13 | Number of AST nodes: 13 | |||
1 | try {↵ | 1 | try {↵ | |
2 | offset+= expectation.prepare( st );↵ | 2 | offset += expectation.prepare( st );↵ | |
3 | //TODO: copy/paste from insertRows()↵ | 3 | //TODO: copy/paste from recreate()↵ | |
4 | int loc = writeKey( st, id, offset, session );↵ | 4 | offset = writeKey( st, id, offset, session );↵ | |
5 | if ( hasIdentifier ) {↵ | 5 | if ( hasIdentifier ) {↵ | |
6 | loc = writeIdentifier( st, collection.getIdentifier(entry, i), loc, session );↵ | 6 | offset = writeIdentifier( st, collection.getIdentifier(entry, i), offset, session );↵ | |
7 | }↵ | 7 | }↵ | |
8 | if ( hasIndex /*&& !indexIsFormula*/ ) {↵ | 8 | if ( hasIndex /*&& !indexIsFormula*/ ) {↵ | |
9 | loc = writeIndex( st, collection.getIndex(entry, i, this), loc, session );↵ | 9 | offset = writeIndex( st, collection.getIndex(entry, i, this), offset, session );↵ | |
10 | }↵ | 10 | }↵ | |
11 | loc = writeElement(st, collection.getElement(entry), loc, session );↵ | 11 | writeElement(st, collection.getElement(entry), offset, session );↵ | |
12 | if ( useBatch ) {↵ | 12 | if ( useBatch ) {↵ | |
13 | session.getBatcher().addToBatch( expectation );↵ | 13 | session.getBatcher().addToBatch( expectation );↵ | |
14 | }↵ | 14 | }↵ | |
15 | else {↵ | 15 | else {↵ | |
16 | expectation.verifyOutcome( st.executeUpdate(), st, -1 );↵ | 16 | expectation.verifyOutcome( st.executeUpdate(), st, -1 );↵ | |
17 | }↵ | 17 | }↵ | |
18 | collection.afterRowInsert( this, entry, i );↵ | 18 | collection.afterRowInsert( this, entry, i );↵ | |
19 | count++;↵ | 19 | count++;↵ | |
20 | }↵ | 20 | }↵ | |
21 | catch ( SQLException sqle ) {↵ | 21 | catch ( SQLException sqle ) {↵ | |
22 | if ( useBatch ) {↵ | 22 | if ( useBatch ) {↵ | |
23 | session.getBatcher().abortBatch( sqle );↵ | 23 | session.getBatcher().abortBatch( sqle );↵ | |
24 | }↵ | 24 | }↵ | |
25 | throw sqle;↵ | 25 | throw sqle;↵ | |
26 | }↵ | 26 | }↵ | |
27 | finally {↵ | 27 | finally {↵ | |
28 | if ( !useBatch ) {↵ | 28 | if ( !useBatch ) {↵ | |
29 | session.getBatcher().closeStatement( st );↵ | 29 | session.getBatcher().closeStatement( st );↵ | |
30 | }↵ | 30 | }↵ | |
31 | } | 31 | } | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.9 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 74 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 13.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
26 | try | 26 | try | ||||||||||||||||||
27 | offset += expectation.prepare(st); | 27 | offset += expectation.prepare(st); | ||||||||||||||||||
|
| 28 | offset = writeKey(st, id, offset, session); | ||||||||||||||||||
28 | int loc = writeKey(st, id, offset, session); |
| | ||||||||||||||||||
29 | if (hasIdentifier) | 29 | if (hasIdentifier) | ||||||||||||||||||
30 | loc = writeIdentifier(st, collection.getIdentifier(entry, i), loc, session); |
| 30 | offset = writeIdentifier(st, collection.getIdentifier(entry, i), offset, session); | |||||||||||||||||
31 | if (hasIndex) | 31 | if (hasIndex) | ||||||||||||||||||
32 | loc = writeIndex(st, collection.getIndex(entry, i, this), loc, session); |
| 32 | offset = writeIndex(st, collection.getIndex(entry, i, this), offset, session); | |||||||||||||||||
|
| 33 | writeElement(st, collection.getElement(entry), offset, session); | ||||||||||||||||||
33 | loc = writeElement(st, collection.getElement(entry), loc, session); |
| | ||||||||||||||||||
34 | if (useBatch) | 34 | if (useBatch) | ||||||||||||||||||
35 | session.getBatcher().addToBatch(expectation); | 35 | session.getBatcher().addToBatch(expectation); | ||||||||||||||||||
else | else | ||||||||||||||||||||
36 | expectation.verifyOutcome(st.executeUpdate(), st, -1); | 36 | expectation.verifyOutcome(st.executeUpdate(), st, -1); | ||||||||||||||||||
37 | collection.afterRowInsert(this, entry, i); | 37 | collection.afterRowInsert(this, entry, i); | ||||||||||||||||||
38 | count++; | 38 | count++; |
Row | Violation |
---|---|
1 | Unmatched statement offset=writeKey(st,id,offset,session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement offset=writeKey(st,id,offset,session); 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 |
3 | Unmatched statement int loc=writeKey(st,id,offset,session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement int loc=writeKey(st,id,offset,session); 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 |
5 | Expression loc cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression offset cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression loc cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression offset cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement writeElement(st,collection.getElement(entry),offset,session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Unmatched statement writeElement(st,collection.getElement(entry),offset,session); 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 |
11 | Unmatched statement loc=writeElement(st,collection.getElement(entry),loc,session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Unmatched statement loc=writeElement(st,collection.getElement(entry),loc,session); 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 |
13 | Clone fragment #1 returns variables offset, loc, count , while Clone fragment #2 returns variables offset, count |