File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/sql/check/ResultCheckStyleTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/sql/check/ResultCheckStyleTest.java | |||
Method name: void testDeleteWithExceptionChecking()
|
Method name: void testUpdateFailureWithExceptionChecking()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction();↵ | 2 | s.beginTransaction();↵ | |
3 | ExceptionCheckingEntity e = new ExceptionCheckingEntity();↵ | 3 | ExceptionCheckingEntity e = new ExceptionCheckingEntity();↵ | |
4 | e.setId( new Long( 1 ) );↵ | 4 | e.setId( new Long( 1 ) );↵ | |
5 | e.setName( "dummy" );↵ | 5 | e.setName( "dummy" );↵ | |
6 | s.delete( e );↵ | 6 | s.update( e );↵ | |
7 | try {↵ | 7 | try {↵ | |
8 | s.flush();↵ | 8 | s.flush();↵ | |
9 | fail( "expection flush failure!" );↵ | 9 | fail( "expection flush failure!" );↵ | |
10 | }↵ | 10 | }↵ | |
11 | catch( JDBCException ex ) {↵ | 11 | catch( JDBCException ex ) {↵ | |
12 | // these should specifically be JDBCExceptions...↵ | 12 | // these should specifically be JDBCExceptions...↵ | |
13 | }↵ | 13 | }↵ | |
14 | s.clear();↵ | 14 | s.clear();↵ | |
15 | s.getTransaction().commit();↵ | 15 | s.getTransaction().commit();↵ | |
16 | s.close(); | 16 |
| |
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 declared in the same class |
Number of node comparisons | 54 |
Number of mapped statements | 12 |
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) | 2.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | |||||||||||||||
2 | s.beginTransaction(); | 2 | s.beginTransaction(); | |||||||||||||||
3 | ExceptionCheckingEntity e = new ExceptionCheckingEntity(); | 3 | ExceptionCheckingEntity e = new ExceptionCheckingEntity(); | |||||||||||||||
4 | e.setId(new Long(1)); | 4 | e.setId(new Long(1)); | |||||||||||||||
5 | e.setName("dummy"); | 5 | e.setName("dummy"); | |||||||||||||||
6 | s.delete(e); |
| 6 | s.update(e); | ||||||||||||||
7 | try | 7 | try | |||||||||||||||
8 | s.flush(); | 8 | s.flush(); | |||||||||||||||
9 | fail("expection flush failure!"); | 9 | fail("expection flush failure!"); | |||||||||||||||
10 | s.clear(); | 10 | s.clear(); | |||||||||||||||
11 | s.getTransaction().commit(); | 11 | s.getTransaction().commit(); | |||||||||||||||
12 | s.close(); | 12 | s.close(); |
Row | Violation |
---|---|
1 | Expression s.delete(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression s.update(e) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression s.delete(e) is a void method call, and thus it cannot be parameterized |
4 | Expression s.update(e) is a void method call, and thus it cannot be parameterized |