File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/query/QueryPlanCache.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/query/ParamLocationRecognizer.java | |||
Method name: ParameterMetadata getSQLParameterMetadata(String)
|
Method name: NamedParameterDescription getOrBuildNamedParameterDescription(String, boolean)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | ParameterMetadata metadata = ( ParameterMetadata ) sqlParamMetadataCache.get( query );↵ | 1 | NamedParameterDescription desc = ( NamedParameterDescription ) namedParameterDescriptions.get( name );↵ | |
2 | if ( metadata == null ) {↵ | 2 | if ( desc == null ) {↵ | |
3 | // for native-sql queries, the param metadata is determined outside↵ | 3 | ↵ | |
4 | // any relation to a query plan, because query plan creation and/or↵ | |||
5 | // retreival for a native-sql query depends on all of the return↵ | |||
6 | // types having been set, which might not be the case up-front when↵ | |||
7 | // param metadata would be most useful↵ | |||
8 | metadata = buildNativeSQLParameterMetadata( query );↵ | |||
9 | sqlParamMetadataCache.put( query, metadata↵ | 4 | desc = new NamedParameterDescription( jpa );↵ | |
10 | );↵ | 5 | namedParameterDescriptions.put( name, desc );↵ | |
11 | }↵ | 6 | }↵ | |
12 | return metadata; | 7 | return desc; | |
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 | 13 |
Number of mapped statements | 2 |
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) | 0.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | NamedParameterDescription desc = (NamedParameterDescription)namedParameterDescriptions.get(name); | ||||||||||||||||||||||||||
1 | ParameterMetadata metadata = (ParameterMetadata)sqlParamMetadataCache.get(query); | | ||||||||||||||||||||||||||
2 | if (metadata == null) |
| 2 | if (desc == null) | ||||||||||||||||||||||||
|
| 3 | desc = new NamedParameterDescription(jpa); | |||||||||||||||||||||||||
3 | metadata = buildNativeSQLParameterMetadata(query); |
| | |||||||||||||||||||||||||
4 | sqlParamMetadataCache.put(query, metadata); |
| 4 | namedParameterDescriptions.put(name, desc); | ||||||||||||||||||||||||
|
| 5 | return desc; | |||||||||||||||||||||||||
5 | return metadata; |
| |
Row | Violation |
---|---|
1 | Type org.hibernate.engine.query.ParameterMetadata of variable metadata does not match with type org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription of variable desc |
2 | Unmatched statement desc=new NamedParameterDescription(jpa); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement metadata=buildNativeSQLParameterMetadata(query); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Type org.hibernate.engine.query.ParameterMetadata of variable metadata does not match with type org.hibernate.engine.query.ParamLocationRecognizer.NamedParameterDescription of variable desc |
5 | Type org.hibernate.util.SimpleMRUCache of variable sqlParamMetadataCache does not match with type java.util.Map of variable namedParameterDescriptions |
6 | Unmatched return desc; |
7 | Unmatched return metadata; |