File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/PessimisticBulkOperationsTest.java | File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/functional/bulk/PessimisticBulkOperationsTest.java | |||
Method name: List
|
Method name: List
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | String selectHQL = "select contact.id from Contact contact";↵ | 1 | String selectHQL = "select contact.id from Contact contact";↵ | |
2 | selectHQL += " where contact.tlf = :cTLF";↵ | 2 | selectHQL += " where contact.customer.name = :cName";↵ | |
3 | SimpleJtaTransactionManagerImpl.getInstance().begin();↵ | 3 | SimpleJtaTransactionManagerImpl.getInstance().begin();↵ | |
4 | try {↵ | 4 | try {↵ | |
5 | ↵ | 5 | ↵ | |
6 | Session session = getSessions().getCurrentSession();↵ | 6 | Session session = getSessions().getCurrentSession();↵ | |
7 | List results = session.createQuery(selectHQL)↵ | 7 | List results = session.createQuery(selectHQL)↵ | |
8 | .setFlushMode(FlushMode.AUTO)↵ | 8 | .setFlushMode(FlushMode.AUTO)↵ | |
9 | .setParameter("cTLF", tlf)↵ | 9 | .setParameter("cName", customerName)↵ | |
10 | .list();↵ | 10 | .list();↵ | |
11 | SimpleJtaTransactionManagerImpl.getInstance().commit();↵ | 11 | SimpleJtaTransactionManagerImpl.getInstance().commit();↵ | |
12 | return results; ↵ | 12 | return results; ↵ | |
13 | }↵ | 13 | }↵ | |
14 | catch (Exception e) {↵ | 14 | catch (Exception e) {↵ | |
15 | SimpleJtaTransactionManagerImpl.getInstance().rollback();↵ | 15 | SimpleJtaTransactionManagerImpl.getInstance().rollback();↵ | |
16 | throw e; ↵ | 16 | throw e; ↵ | |
17 | } | 17 |
| |
See real code fragment | See real code fragment |
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 | 34 |
Number of mapped statements | 8 |
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.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | String selectHQL = "select contact.id from Contact contact"; | 1 | String selectHQL = "select contact.id from Contact contact"; | ||||||||||||||
2 | selectHQL += " where contact.tlf = :cTLF"; |
| 2 | selectHQL += " where contact.customer.name = :cName"; | |||||||||||||
3 | SimpleJtaTransactionManagerImpl.getInstance().begin(); | 3 | SimpleJtaTransactionManagerImpl.getInstance().begin(); | ||||||||||||||
4 | try | 4 | try | ||||||||||||||
5 | Session session = getSessions().getCurrentSession(); | 5 | Session session = getSessions().getCurrentSession(); | ||||||||||||||
6 | List results = session.createQuery(selectHQL).setFlushMode(FlushMode.AUTO).setParameter("cTLF", tlf).list(); |
| 6 | List results = session.createQuery(selectHQL).setFlushMode(FlushMode.AUTO).setParameter("cName", customerName).list(); | |||||||||||||
7 | SimpleJtaTransactionManagerImpl.getInstance().commit(); | 7 | SimpleJtaTransactionManagerImpl.getInstance().commit(); | ||||||||||||||
8 | return results; | 8 | return results; |
Row | Violation |
---|