File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/keymanytoone/bidir/component/LazyKeyManyToOneTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/sql/hand/query/NativeSQLQueriesTest.java | |||
Method name: void testSaveCascadedToKeyManyToOne()
|
Method name: void testMixAndMatchEntityScalar()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 12 | |||
1 | Session s = openSession(); ↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction(); ↵ | 2 | Transaction t = s.beginTransaction();↵ | |
3 | Customer cust = new Customer( "Acme, Inc." ); ↵ | 3 | Speech speech = new Speech();↵ | |
4 | Order order = new Order( new Order.Id( cust, 1 ) ); ↵ | 4 | speech.setLength( new Double( 23d ) );↵ | |
5 | cust.getOrders().add( order ); ↵ | 5 | speech.setName( "Mine" );↵ | |
6 | s.save( cust ); ↵ | 6 | s.persist( speech );↵ | |
7 | s.flush(); ↵ | 7 | s.flush();↵ | |
8 | assertEquals( 2, sfi().getStatistics().getEntityInsertCount() );↵ | 8 | ↵ | |
9 | s.delete( cu↵ | 9 | s.clear();↵ | |
10 | List l = s.createSQLQuery( "select name, id, flength, name as scalarName from Speech" )↵ | |||
11 | .setResultSetMapping( "speech" )↵ | |||
10 | st ); ↵ | 12 | .list();↵ | |
11 | s.getTransaction().commit↵ | 13 | assertEquals( l.size(), 1 );↵ | |
12 | (); ↵ | 14 | t.rollback();↵ | |
13 | 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.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 132 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 5 |
Number of unmapped statements in the second code fragment | 6 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | |||||||||||||||||||||||
|
| 2 | Transaction t = s.beginTransaction(); | |||||||||||||||||||||||
2 | s.beginTransaction(); | | ||||||||||||||||||||||||
| 3 | Speech speech = new Speech(); | ||||||||||||||||||||||||
3 | Customer cust = new Customer("Acme, Inc."); | | ||||||||||||||||||||||||
| 4 | speech.setLength(new Double(23d)); | ||||||||||||||||||||||||
4 | Order order = new Order(new Order.Id(cust, 1)); | | ||||||||||||||||||||||||
| 5 | speech.setName("Mine"); | ||||||||||||||||||||||||
5 | cust.getOrders().add(order); | | ||||||||||||||||||||||||
6 | s.save(cust); | | ||||||||||||||||||||||||
7 | s.flush(); | 7 | s.flush(); | |||||||||||||||||||||||
8 | assertEquals(2, sfi().getStatistics().getEntityInsertCount()); |
| 6 | s.persist(speech); | ||||||||||||||||||||||
9 | s.delete(cust); |
| 8 | s.clear(); | ||||||||||||||||||||||
| 9 | List l = s.createSQLQuery("select name, id, flength, name as scalarName from Speech").setResultSetMapping("speech").list(); | ||||||||||||||||||||||||
| 10 | assertEquals(l.size(), 1); | ||||||||||||||||||||||||
10 | s.getTransaction().commit(); |
| 11 | t.rollback(); | ||||||||||||||||||||||
11 | s.close(); | 12 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement Transaction t=s.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Expression s.persist(speech) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression assertEquals(2,sfi().getStatistics().getEntityInsertCount()) is a void method call, and thus it cannot be parameterized |
4 | Expression s.persist(speech) is a void method call, and thus it cannot be parameterized |
5 | Expression s.persist(speech) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression assertEquals(2,sfi().getStatistics().getEntityInsertCount()) is a void method call, and thus it cannot be parameterized |
7 | Expression s.persist(speech) is a void method call, and thus it cannot be parameterized |
8 | Expression s.delete(cust) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression s.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression s.delete(cust) is a void method call, and thus it cannot be parameterized |
11 | Expression s.clear() is a void method call, and thus it cannot be parameterized |
12 | Expression s.delete(cust) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression s.clear() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression s.delete(cust) is a void method call, and thus it cannot be parameterized |
15 | Expression s.clear() is a void method call, and thus it cannot be parameterized |
16 | Expression s.getTransaction().commit() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression s.getTransaction().commit() is a void method call, and thus it cannot be parameterized |
18 | Expression t.rollback() is a void method call, and thus it cannot be parameterized |
19 | Expression s.getTransaction() cannot be parameterized, because it has dependencies to/from statements that will be extracted |