Object old = it.next();
Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session);
if ( !currentIds.contains( new TypedValue( idType, oldId, session.getEntityMode() ) ) ) {
res.add(old);
}
joinFragment.addCrossJoin( rootJoinable.getTableName(), rootAlias );
String filterCondition = rootJoinable.filterFragment( rootAlias, enabledFilters );
// JoinProcessor needs to know if the where clause fragment came from a dynamic filter or not so it
// can put the where clause fragment in the right place in the SQL AST. 'hasFilterCondition' keeps track
// of that fact.
joinFragment.setHasFilterCondition( joinFragment.addCondition( filterCondition ) );
if (includeExtraJoins) { //TODO: not quite sure about the full implications of this!
addExtraJoins( joinFragment, rootAlias, rootJoinable, true );
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/AbstractPersistentCollection.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/JoinSequence.java
|
Method name: Collection getOrphans(Collection, Collection, String, SessionImplementor)
|
|
Method name: JoinFragment toJoinFragment(Map, boolean, String, String)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 5
|
|
1 | Object old = it.next();↵ | | 1 | joinFragment.addCrossJoin( rootJoinable.getTableName(), rootAlias );↵
|
2 | Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session);↵ | | 2 | Stri↵
|
3 | if ( !currentIds.contains( new TypedValue( idType, oldId, session.getEntityMode() ) ) ) {↵ | | |
|
4 | res.add(old↵ | | 3 | ng filterCondition = rootJoinable.filterFragment( rootAlias, enabledFilters );↵
|
| | | 4 | // JoinProcessor needs to know if the where clause fragment came from a dynamic filter or not so it↵
|
| | | 5 | // can put the where clause fragment in the right place in the SQL AST. 'hasFilterCondition' keeps track↵
|
| | | 6 | // of that fact.↵
|
| | | 7 | joinFragment.setHasFilterCondition( joinFragment.addCondition( filterCondition ) );↵
|
| | | 8 | if (includeExtraJoins) { //TODO: not quite sure about the full implications of this!↵
|
5 | );↵ | | 9 | addExtraJoins( joinFragment, rootAlias, rootJoinable, true );↵
|
6 | } | | 10 | }
|
See real code fragment |
|
See real code fragment |
Summary
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.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 11 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 130.4 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
| | | 3 | joinFragment.addCrossJoin(rootJoinable.getTableName(), rootAlias); |
| | | 4 | String filterCondition = rootJoinable.filterFragment(rootAlias, enabledFilters); |
| | | 5 | joinFragment.setHasFilterCondition(joinFragment.addCondition(filterCondition)); |
14 | Object old = it.next(); | | | |
15 | Serializable oldId = ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName, old, session); | | | |
16 | if (!currentIds.contains(new TypedValue(idType, oldId, session.getEntityMode()))) | | 6 | if (includeExtraJoins) |
| | | 7 | addExtraJoins(joinFragment, rootAlias, rootJoinable, true); |
17 | | | | |
Precondition Violations (1)
Row |
Violation |
1 | Unmatched statement Serializable oldId=ForeignKeys.getEntityIdentifierIfNotUnsaved(entityName,old,session); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |