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/tuple/entity/EntityTuplizerFactory.java | |||
Method name: Serializable generate(SessionImplementor, Object)
|
Method name: EntityTuplizer constructDefaultTuplizer(EntityMode, EntityMetamodel, PersistentClass)
|
|||
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() );↵ | 1 | Class tuplizerClass = ( Class ) defaultImplClassByMode.get( entityMode );↵ | |
4 | ↵ | 2 | ↵ | |
5 | if (id==null) {↵ | 3 | if ( tuplizerClass == null ) {↵ | |
6 | throw new IdentifierGenerationException(↵ | 4 | throw new ↵ | |
7 | "ids for this class must be manually assigned before calling save(): " + ↵ | |||
8 | entityName↵ | |||
9 | );↵ | 5 | HibernateException( "could not determine default tuplizer class to use [" + entityMode + "]" );↵ | |
10 | }↵ | 6 | }↵ | |
11 | ↵ | |||
12 | return id; | 7 | return constructTuplizer( tuplizerClass, metamodel, persistentClass ); | |
See real code fragment | See real code fragment |
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 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 7.5 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Class tuplizerClass = (Class)defaultImplClassByMode.get(entityMode); | ||||||||||||||||
1 | final Serializable id = session.getEntityPersister(entityName, obj).getIdentifier(obj, session.getEntityMode()); |
| | |||||||||||||||
2 | if (id == null) |
| 2 | if (tuplizerClass == null) | ||||||||||||||
|
| 3 | throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]"); | |||||||||||||||
3 | throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName); |
| | |||||||||||||||
|
| 4 | return constructTuplizer(tuplizerClass, metamodel, persistentClass); | |||||||||||||||
4 | return id; |
| |
Row | Violation |
---|---|
1 | Unmatched statement final Serializable id=session.getEntityPersister(entityName,obj).getIdentifier(obj,session.getEntityMode()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Type java.io.Serializable of variable id does not match with type java.lang.Class of variable tuplizerClass |
3 | Unmatched statement throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]"); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
4 | Unmatched throw new HibernateException("could not determine default tuplizer class to use [" + entityMode + "]"); |
5 | Unmatched statement throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
6 | Unmatched throw new IdentifierGenerationException("ids for this class must be manually assigned before calling save(): " + entityName); |
7 | Unmatched statement return constructTuplizer(tuplizerClass,metamodel,persistentClass); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
8 | Unmatched return constructTuplizer(tuplizerClass,metamodel,persistentClass); |
9 | Unmatched statement return id; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
10 | Unmatched return id; |
11 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |