if ( table.isPhysicalTable() ) {
Iterator subIter = table.getForeignKeyIterator();
while ( subIter.hasNext() ) {
ForeignKey fk = (ForeignKey) subIter.next();
if ( fk.isPhysicalConstraint() ) {
script.add(
fk.sqlDropString(
dialect,
defaultCatalog,
defaultSchema
)
);
}
}
}
throwLazyInitializationExceptionIfNotConnected();
CollectionEntry entry = session.getPersistenceContext().getCollectionEntry(this);
CollectionPersister persister = entry.getLoadedPersister();
if ( persister.isExtraLazy() ) {
if ( hasQueuedOperations() ) {
session.flush();
}
return persister.getElementByIndex( entry.getLoadedKey(), index, session, owner );
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/AbstractPersistentCollection.java
|
Method name: String[] generateDropSchemaScript(Dialect)
|
|
Method name: Object readElementByIndex(Object)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 7
|
|
1 | if ( table.isPhysicalTable() ) {↵ | | |
|
2 | Iterator subIter = table.getForeignKeyIterator();↵ | | |
|
3 | while ( subIter.hasNext() ) {↵ | | |
|
4 | ForeignKey fk = (ForeignKey) subIter.next();↵ | | |
|
5 | if ( fk.isPhysicalConstraint↵ | | 1 | throwLazyInitializationExceptionIfNotConnected();↵
|
| | | 2 | CollectionEntry entry = session.getPersistenceContext().getCollectionEntry(this);↵
|
| | | 3 | CollectionPersister persister = entry.getLoadedPersister();↵
|
| | | 4 | if ( persister.isExtraLazy() ) {↵
|
6 | () ) {↵ | | 5 | if ( hasQueuedOperations() ) {↵
|
7 | script.add(↵ | | 6 | session.flush();↵
|
8 | ↵ | | 7 | }↵
|
9 | fk.sqlDropString(↵ | | 8 | ↵
|
10 | dialect,↵ | | |
|
11 | defaultCatalog,↵ | | |
|
12 | defaultSchema↵ | | |
|
13 | )↵ | | |
|
14 | );↵ | | |
|
15 | }↵ | | |
|
16 | }↵ | | |
|
17 | ↵ | | 9 | return persister.getElementByIndex( entry.getLoadedKey(), index, session, owner );↵
|
18 | } | | 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 | 5 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 19.3 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
17 | ForeignKey fk = (ForeignKey)subIter.next(); | | | |
18 | if (fk.isPhysicalConstraint()) | | 6 | if (hasQueuedOperations()) |
| | | 7 | |
19 | script.add(fk.sqlDropString(dialect, defaultCatalog, defaultSchema)); | | | |
Precondition Violations (1)
Row |
Violation |
1 | Unmatched statement ForeignKey fk=(ForeignKey)subIter.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |