if ( persister.hasCache() ) {
CacheKey key = new CacheKey(
entityKey.getIdentifier(),
persister.getIdentifierType(),
entityKey.getEntityName(),
entityMode,
context.getSession().getFactory()
);
return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null;
}
if ( persister.hasCache() ) {
CacheKey cacheKey = new CacheKey(
collectionKey,
persister.getKeyType(),
persister.getRole(),
entityMode,
context.getSession().getFactory()
);
return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null;
}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/BatchFetchQueue.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/BatchFetchQueue.java
|
Method name: boolean isCached(EntityKey, EntityPersister, EntityMode)
|
|
Method name: boolean isCached(Serializable, CollectionPersister, EntityMode)
|
Number of AST nodes: 3
|
|
Number of AST nodes: 3
|
|
1 | if ( persister.hasCache() ) {↵ | | 1 | if ( persister.hasCache() ) {↵
|
2 | CacheKey key = new CacheKey(↵ | | 2 | CacheKey cacheKey = new CacheKey(↵
|
3 | entityKey.getIdentifier(),↵ | | 3 | ↵
|
4 | ↵ | | 4 | collectionKey,↵
|
5 | persister.getIdentifierType(),↵ | | 5 | persister.getKeyType(),↵
|
6 | entityKey.getEntityName(),↵ | | 6 | ↵
|
7 | ↵ | | 7 | persister.getRole(),↵
|
8 | entityMode,↵ | | 8 | entityMode,↵
|
9 | context.getSession().getFactory()↵ | | 9 | context.getSession().getFactory()↵
|
10 | );↵ | | 10 | );↵
|
11 | return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null;↵ | | 11 | return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null;↵
|
12 | } | | 12 | }
|
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 declared in the same class |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (persister.hasCache()) | | 1 | if (persister.hasCache()) |
| | | 2 | CacheKey cacheKey = new CacheKey(collectionKey, persister.getKeyType(), persister.getRole(), entityMode, context.getSession().getFactory()); |
2 | CacheKey key = new CacheKey(entityKey.getIdentifier(), persister.getIdentifierType(), entityKey.getEntityName(), entityMode, context.getSession().getFactory()); | | | |
3 | return persister.getCacheAccessStrategy().get(key, context.getSession().getTimestamp()) != null; | | 3 | return persister.getCacheAccessStrategy().get(cacheKey, context.getSession().getTimestamp()) != null; |
Precondition Violations (3)
Row |
Violation |
1 | Type org.hibernate.persister.entity.EntityPersister of variable persister does not match with type org.hibernate.persister.collection.CollectionPersister of variable persister |
2 | Type org.hibernate.cache.access.EntityRegionAccessStrategy of variable persister.getCacheAccessStrategy() does not match with type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable persister.getCacheAccessStrategy() |
3 | Type org.hibernate.persister.entity.EntityPersister of variable persister does not match with type org.hibernate.persister.collection.CollectionPersister of variable persister |