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 testInsertionFailureWithExceptionChecking()
|
Method name: void testInsertionFailureWithParamChecking()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction();↵ | 2 | s.beginTransaction();↵ | |
3 | ExceptionCheckingEntity e = new ExceptionCheckingEntity();↵ | 3 | ParamCheckingEntity e = new ParamCheckingEntity();↵ | |
4 | e.setName( "dummy" );↵ | 4 | e.setName( "dummy" );↵ | |
5 | s.save( e );↵ | 5 | s.save( e );↵ | |
6 | try {↵ | 6 | try {↵ | |
7 | s.flush();↵ | 7 | s.flush();↵ | |
8 | fail( "expection flush failure!" );↵ | 8 | fail( "expection flush failure!" );↵ | |
9 | }↵ | 9 | }↵ | |
10 | catch( JDBCException ex ) {↵ | 10 | catch( HibernateException ex ) {↵ | |
11 | // these should specifically be JDBCExceptions...↵ | 11 | // these should specifically be HibernateExceptions...↵ | |
12 | }↵ | 12 | }↵ | |
13 | s.clear();↵ | 13 | s.clear();↵ | |
14 | s.getTransaction().commit();↵ | 14 | s.getTransaction().commit();↵ | |
15 | s.close(); | 15 |
| |
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 | 61 |
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 3.1 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | ||||||||||||||
2 | s.beginTransaction(); | 2 | s.beginTransaction(); | ||||||||||||||
| 3 | ParamCheckingEntity e = new ParamCheckingEntity(); | |||||||||||||||
3 | ExceptionCheckingEntity e = new ExceptionCheckingEntity(); | | |||||||||||||||
4 | e.setName("dummy"); |
| 4 | e.setName("dummy"); | |||||||||||||
5 | s.save(e); |
| 5 | s.save(e); | |||||||||||||
6 | try |
| 6 | try | |||||||||||||
7 | s.flush(); | 7 | s.flush(); | ||||||||||||||
8 | fail("expection flush failure!"); | 8 | fail("expection flush failure!"); | ||||||||||||||
9 | s.clear(); | 9 | s.clear(); | ||||||||||||||
10 | s.getTransaction().commit(); | 10 | s.getTransaction().commit(); | ||||||||||||||
11 | s.close(); | 11 | s.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.sql.check.ExceptionCheckingEntity of variable e does not match with type org.hibernate.test.sql.check.ParamCheckingEntity of variable e |
2 | Type org.hibernate.test.sql.check.ExceptionCheckingEntity of variable e does not match with type org.hibernate.test.sql.check.ParamCheckingEntity of variable e |