if ( log.isDebugEnabled() ) {
log.debug(
"loading entity: " +
MessageHelper.infoString( persister, id, identifierType, getFactory() )
);
}
List result;
try {
result = doQueryAndInitializeNonLazyCollections(
session,
new QueryParameters(
new Type[] { identifierType },
new Object[] { id },
optionalObject,
optionalEntityName,
optionalIdentifier
),
false
);
}
catch ( SQLException sqle ) {
final Loadable[] persisters = getEntityPersisters();
throw JDBCExceptionHelper.convert(
factory.getSQLExceptionConverter(),
sqle,
"could not load an entity: " +
MessageHelper.infoString( persisters[persisters.length-1], id, identifierType, getFactory() ),
getSQLString()
);
}
log.debug("done entity load");
return result;
if ( log.isDebugEnabled() ) {
log.debug(
"batch loading entity: " +
MessageHelper.infoString(persister, ids, getFactory() )
);
}
Type[] types = new Type[ids.length];
Arrays.fill( types, idType );
List result;
try {
result = doQueryAndInitializeNonLazyCollections(
session,
new QueryParameters( types, ids, optionalObject, optionalEntityName, optionalId ),
false
);
}
catch ( SQLException sqle ) {
throw JDBCExceptionHelper.convert(
factory.getSQLExceptionConverter(),
sqle,
"could not load an entity batch: " +
MessageHelper.infoString( getEntityPersisters()[0], ids, getFactory() ),
getSQLString()
);
}
log.debug("done entity batch load");
return result;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/Loader.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/Loader.java
|
Method name: List loadEntity(SessionImplementor, Object, Type, Object, String, Serializable, EntityPersister)
|
|
Method name: List loadEntityBatch(SessionImplementor, Serializable[], Type, Object, String, Serializable, EntityPersister)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 9
|
|
1 | if ( log.isDebugEnabled() ) {↵ | | 1 | if ( log.isDebugEnabled() ) {↵
|
2 | log.debug( ↵ | | 2 | log.debug( ↵
|
3 | "loading entity: " + ↵ | | 3 | "batch loading entity: " + ↵
|
4 | MessageHelper.infoString( persister, id, identifierType, getFactory() ) ↵ | | 4 | MessageHelper.infoString(persister, ids, getFactory() ) ↵
|
5 | );↵ | | 5 | );↵
|
6 | }↵ | | 6 | }↵
|
|
| | | 7 | Type[] types = new Type[ids.length];↵
|
| | | 8 | Arrays.fill( types, idType );↵
|
7 | List result;↵ | | 9 | List result;↵
|
8 | try {↵ | | 10 | try {↵
|
9 | result = doQueryAndInitializeNonLazyCollections( ↵ | | 11 | result = doQueryAndInitializeNonLazyCollections( ↵
|
10 | session,↵ | | 12 | session,↵
|
11 | new QueryParameters( ↵ | | 13 | new QueryParameters( ↵
|
12 | new Type[] { identifierType },↵ | | |
|
13 | new Object[] { id },↵ | | |
|
14 | optionalObject,↵ | | 14 | types, ids, optionalObject,↵
|
15 | optionalEntityName,↵ | | 15 | optionalEntityName,↵
|
16 | optionalIdentifier ↵ | | 16 | optionalId↵
|
17 | ),↵ | | 17 | ),↵
|
18 | false ↵ | | 18 | false ↵
|
19 | );↵ | | 19 | );↵
|
20 | }↵ | | 20 | }↵
|
21 | catch ( SQLException sqle ) {↵ | | 21 | catch ( SQLException sqle ) {↵
|
22 | final Loadable[] persisters = getEntityPersisters();↵ | | 22 | ↵
|
23 | throw JDBCExceptionHelper.convert(↵ | | 23 | throw JDBCExceptionHelper.convert(↵
|
24 | factory.getSQLExceptionConverter(),↵ | | 24 | factory.getSQLExceptionConverter(),↵
|
25 | sqle,↵ | | 25 | sqle,↵
|
26 | "could not load an entity: " + ↵ | | 26 | "could not load an entity batch: " + ↵
|
27 | MessageHelper.infoString( persisters[persisters.length-1], id, identifierType, getFactory() ),↵ | | 27 | MessageHelper.infoString( getEntityPersisters()[0], ids, getFactory() ),↵
|
28 | getSQLString()↵ | | 28 | getSQLString()↵
|
29 | );↵ | | 29 | );↵
|
30 | }↵ | | 30 | }↵
|
|
31 | log.debug("done entity load");↵ | | 31 | log.debug("done entity batch load");↵
|
32 | ↵ | | 32 | ↵
|
33 | return result; | | 33 | return result;
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 7 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.1 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (log.isDebugEnabled()) | | 1 | if (log.isDebugEnabled()) |
2 | log.debug("loading entity: " + MessageHelper.infoString(persister, id, identifierType, getFactory())); | | 2 | log.debug("batch loading entity: " + MessageHelper.infoString(persister, ids, getFactory())); |
Precondition Violations (0)
Row |
Violation |