File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/abstractembeddedcomponents/propertyref/AbstractComponentPropertyRefTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java | |||
Method name: void testPropertiesRefCascades()
|
Method name: void testNoForeignKeyViolations()
|
|||
Number of AST nodes: 19 | Number of AST nodes: 17 | |||
1 | Session session = openSession(); ↵ | 1 | Session s = openSession();↵ | |
2 | Transaction trans = session.beginTransaction(); ↵ | 2 | Glarch g1 = new Glarch();↵ | |
3 | ServerImpl server = new ServerImpl(); ↵ | 3 | Glarch g2 = new Glarch();↵ | |
4 | session.save( server ); ↵ | 4 | g1.setNext(g2);↵ | |
5 | AddressImpl address = new AddressImpl(); ↵ | 5 | g2.setNext(g1);↵ | |
6 | server.setAddress( address ); ↵ | 6 | s.save(g1);↵ | |
7 | address.setServer( server ); ↵ | 7 | s.save(g2);↵ | |
8 | session.flush(); ↵ | 8 | s.flush();↵ | |
9 | session.createQuery( "from Server s join fetch s.address" ).list();↵ | 9 | s↵ | |
10 | trans.commit(); ↵ | 10 | .connection().commit();↵ | |
11 | session.close();↵ | 11 | s.close();↵ | |
12 | assertNotNull( server.getId() );↵ | |||
13 | assertNotNull( address.getId() );↵ | |||
14 | session↵ | |||
15 | = openSession(); ↵ | 12 | s = openSession();↵ | |
16 | trans = session.beginTransaction(); ↵ | 13 | List l = s.find("from Glarch g where g.next is not null");↵ | |
17 | session.delete( address ); ↵ | 14 | s.delete( l.get(0) );↵ | |
18 | session.delete( server ); ↵ | 15 | s.delete( l.get(1) );↵ | |
19 | trans↵ | 16 | s.flush();↵ | |
20 | .commit(); ↵ | 17 | s.connection().commit();↵ | |
21 | session.close(); | 18 | s.close(); | |
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 | 323 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 13 |
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 session = openSession(); | | |||||||||||||||||||||||
| 2 | Glarch g1 = new Glarch(); | |||||||||||||||||||||||
2 | Transaction trans = session.beginTransaction(); | | |||||||||||||||||||||||
| 3 | Glarch g2 = new Glarch(); | |||||||||||||||||||||||
3 | ServerImpl server = new ServerImpl(); | | |||||||||||||||||||||||
| 4 | g1.setNext(g2); | |||||||||||||||||||||||
| 5 | g2.setNext(g1); | |||||||||||||||||||||||
4 | session.save(server); |
| 6 | s.save(g1); | |||||||||||||||||||||
5 | AddressImpl address = new AddressImpl(); | | |||||||||||||||||||||||
6 | server.setAddress(address); | | |||||||||||||||||||||||
| 7 | s.save(g2); | |||||||||||||||||||||||
7 | address.setServer(server); | | |||||||||||||||||||||||
8 | session.flush(); |
| 8 | s.flush(); | |||||||||||||||||||||
9 | session.createQuery("from Server s join fetch s.address").list(); | | |||||||||||||||||||||||
10 | trans.commit(); | | |||||||||||||||||||||||
11 | session.close(); |
| 10 | s.close(); | |||||||||||||||||||||
12 | assertNotNull(server.getId()); |
| 9 | s.connection().commit(); | |||||||||||||||||||||
|
| 11 | s = openSession(); | ||||||||||||||||||||||
| 12 | List l = s.find("from Glarch g where g.next is not null"); | |||||||||||||||||||||||
| 13 | s.delete(l.get(0)); | |||||||||||||||||||||||
| 14 | s.delete(l.get(1)); | |||||||||||||||||||||||
13 | assertNotNull(address.getId()); |
| 15 | s.flush(); | |||||||||||||||||||||
14 | session = openSession(); |
| | ||||||||||||||||||||||
15 | trans = session.beginTransaction(); | | |||||||||||||||||||||||
| 16 | s.connection().commit(); | |||||||||||||||||||||||
16 | session.delete(address); | | |||||||||||||||||||||||
17 | session.delete(server); | | |||||||||||||||||||||||
18 | trans.commit(); | | |||||||||||||||||||||||
19 | session.close(); |
| 17 | s.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.abstractembeddedcomponents.propertyref.ServerImpl of variable server does not match with type org.hibernate.test.legacy.Glarch of variable g1 |
2 | Type org.hibernate.Session of variable session does not match with type org.hibernate.classic.Session of variable s |
3 | Type org.hibernate.Session of variable session does not match with type org.hibernate.classic.Session of variable s |
4 | Type org.hibernate.Session of variable session does not match with type org.hibernate.classic.Session of variable s |
5 | Expression assertNotNull(server.getId()) is a void method call, and thus it cannot be parameterized |
6 | Expression s.connection().commit() is a void method call, and thus it cannot be parameterized |
7 | Expression assertNotNull(server.getId()) is a void method call, and thus it cannot be parameterized |
8 | Expression s.connection().commit() is a void method call, and thus it cannot be parameterized |
9 | Unmatched statement s=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
10 | Expression assertNotNull(address.getId()) is a void method call, and thus it cannot be parameterized |
11 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
12 | Expression assertNotNull(address.getId()) is a void method call, and thus it cannot be parameterized |
13 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
14 | Unmatched statement session=openSession(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
15 | Type org.hibernate.Session of variable session does not match with type org.hibernate.classic.Session of variable s |