File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/keymanytoone/bidir/component/EagerKeyManyToOneTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testLoadEntityWithEagerFetchingToKeyManyToOneReferenceBackToSelfFailureExpected()
|
Method name: void testSerializableType()
|
|||
Number of AST nodes: 15 | Number of AST nodes: 17 | |||
1 | Session s = openSession(); ↵ | 1 | Session s = openSession();↵ | |
2 | s.beginTransaction(); ↵ | 2 | Vetoer v = new Vetoer();↵ | |
3 | Customer cust = new Customer( "Acme, Inc." ); ↵ | 3 | v.setStrings( new String[] { "foo", "bar", "baz" } );↵ | |
4 | Order order = new Order( new Order.Id( cust, 1 ) ); ↵ | 4 | s.save(v); Serializable id = s.save(v);↵ | |
5 | cust.getOrders().add( order );↵ | 5 | ↵ | |
6 | s.save( cust ↵ | 6 | v.getStrings()[1] = "osama";↵ | |
7 | ); ↵ | 7 | s.flush();↵ | |
8 | s.getTransaction().commit(); ↵ | 8 | s.connection().commit();↵ | |
9 | s.close();↵ | 9 | s.close();↵ | |
10 | ↵ | |||
11 | s = openSession(); ↵ | 10 | s = openSession();↵ | |
12 | s.beginTransaction();↵ | 11 | ↵ | |
13 | try {↵ | |||
14 | cust = ( Customer ) s.get( Customer.class, cust.getId() ); ↵ | 12 | v = (Vetoer) s.load(Vetoer.class, id);↵ | |
15 | }↵ | 13 | ↵ | |
16 | catch( OverflowCondition overflow ) {↵ | |||
17 | fail( "get()/load() caused overflow condition" );↵ | |||
18 | }↵ | |||
19 | s.delete( cust ↵ | 14 | assertTrue( "serializable type", v.getStrings()[1].equals("osama") );↵ | |
15 | s.delete(v); s.delete(v);↵ | |||
20 | ); ↵ | 16 | s.flush();↵ | |
21 | s.getTransaction().commit(); ↵ | 17 | s.connection().commit();↵ | |
22 | s.close(); | 18 |
| |
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 | 169 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 9 |
Number of unmapped statements in the second code fragment | 11 |
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 | Vetoer v = new Vetoer(); | ||||||||||||||||||||
2 | s.beginTransaction(); | | ||||||||||||||||||||
| 3 | v.setStrings(new String[] {"foo", "bar", "baz"}); | ||||||||||||||||||||
3 | Customer cust = new Customer("Acme, Inc."); | | ||||||||||||||||||||
4 | Order order = new Order(new Order.Id(cust, 1)); | | ||||||||||||||||||||
5 | cust.getOrders().add(order); | | ||||||||||||||||||||
6 | s.save(cust); |
| 4 | s.save(v); | ||||||||||||||||||
| 5 | Serializable id = s.save(v); | ||||||||||||||||||||
| 6 | v.getStrings()[1] = "osama"; | ||||||||||||||||||||
| 7 | s.flush(); | ||||||||||||||||||||
7 | s.getTransaction().commit(); |
| 8 | s.connection().commit(); | ||||||||||||||||||
8 | s.close(); |
| 9 | s.close(); | ||||||||||||||||||
9 | s = openSession(); |
| | |||||||||||||||||||
|
| 10 | s = openSession(); | |||||||||||||||||||
10 | s.beginTransaction(); | | ||||||||||||||||||||
|
| 11 | v = (Vetoer)s.load(Vetoer.class, id); | |||||||||||||||||||
11 | try | | ||||||||||||||||||||
12 | cust = (Customer)s.get(Customer.class, cust.getId()); |
| | |||||||||||||||||||
| 12 | assertTrue("serializable type", v.getStrings()[1].equals("osama")); | ||||||||||||||||||||
13 | s.delete(cust); |
| 13 | s.delete(v); | ||||||||||||||||||
| 14 | s.delete(v); | ||||||||||||||||||||
| 15 | s.flush(); | ||||||||||||||||||||
14 | s.getTransaction().commit(); |
| 16 | s.connection().commit(); | ||||||||||||||||||
15 | s.close(); |
| 17 | s.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.keymanytoone.bidir.component.Customer of variable cust does not match with type org.hibernate.test.legacy.Vetoer of variable v |
2 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
3 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
4 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
5 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
6 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement v=(Vetoer)s.load(Vetoer.class,id); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement cust=(Customer)s.get(Customer.class,cust.getId()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Type org.hibernate.test.keymanytoone.bidir.component.Customer of variable cust does not match with type org.hibernate.test.legacy.Vetoer of variable v |
11 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
12 | Type org.hibernate.Transaction of variable s.getTransaction() does not match with type java.sql.Connection of variable s.connection() |
13 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |
14 | Type org.hibernate.Session of variable s does not match with type org.hibernate.classic.Session of variable s |