final Serializable id = session.getEntityPersister( entityName, obj )
//TODO: cache the persister, this shows up in yourkit
.getIdentifier( obj, session.getEntityMode() );
if (id==null) {
throw new IdentifierGenerationException(
"ids for this class must be manually assigned before calling save(): " +
entityName
);
}
return id;
Object id = getIdentifierType().nullSafeGet( rs, alias, session, null );
if ( id == null ) {
throw new HibernateException( "null identifier column for collection: " + role );
}
return id;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/Assigned.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java
|
Method name: Serializable generate(SessionImplementor, Object)
|
|
Method name: Object readIdentifier(ResultSet, String, SessionImplementor)
|
Number of AST nodes: 4
|
|
Number of AST nodes: 4
|
|
1 | final Serializable id = session.getEntityPersister( entityName, obj ) ↵ | | |
|
2 | //TODO: cache the persister, this shows up in yourkit↵ | | |
|
3 | .getIdentifier( obj, session.getEntityMode() );↵ | | |
|
4 | ↵ | | 1 | Object id = getIdentifierType().nullSafeGet( rs, alias, session, null );↵
|
5 | if (id==null) {↵ | | 2 | if ( id == null ) {↵
|
6 | throw new IdentifierGenerationException(↵ | | 3 | throw new ↵
|
7 | "ids for this class must be manually assigned before calling save(): " + ↵ | | 4 | HibernateException( "null identifier column for coll↵
|
8 | entityName↵ | | |
|
9 | );↵ | | 5 | ection: " + role );↵
|
10 | }↵ | | 6 | }↵
|
11 | ↵ | | 7 | ↵
|
12 | return id; | | 8 | return id;
|
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 | 8 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
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) | 0.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
| | | 1 | Object id = getIdentifierType().nullSafeGet(rs, alias, session, null); |
1 | final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode()); | | | |
2 | if (id == null) | | 2 | if (id == null) |
3 | throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName); | | 3 | throw new HibernateException("null identifier column for collection: " + role); |
| | | 4 | return id; |
4 | return id; | | | |
Precondition Violations (3)
Row |
Violation |
1 | Type java.io.Serializable of variable id does not match with type java.lang.Object of variable id |
2 | Unmatched return id; |
3 | Unmatched return id; |