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 testForeignKeys()
|
|||
Number of AST nodes: 19 | Number of AST nodes: 17 | |||
1 | Session session = openSession(); ↵ | 1 | Session s = openSession();↵ | |
2 | Transaction trans = session.beginTransaction(); ↵ | 2 | Baz baz = new Baz();↵ | |
3 | ServerImpl server = new ServerImpl(); ↵ | 3 | Foo foo = new Foo();↵ | |
4 | session.save( server ); ↵ | 4 | List bag = new ArrayList();↵ | |
5 | AddressImpl address = new AddressImpl(); ↵ | 5 | bag.add(foo);↵ | |
6 | server.setAddress( address ); ↵ | 6 | baz.setIdFooBag(bag);↵ | |
7 | address.setServer( server ↵ | 7 | baz.setFoo(foo);↵ | |
8 | ); ↵ | 8 | s.save(baz);↵ | |
9 | session.flush(); ↵ | 9 | s.flush();↵ | |
10 | session.createQuery( "from Server s join fetch s.address" ).list();↵ | 10 | s↵ | |
11 | trans.commit(); ↵ | 11 | .connection().commit();↵ | |
12 | session.close();↵ | 12 | s.close();↵ | |
13 | assertNotNull( server.getId() );↵ | |||
14 | assertNotNull( address.getId() );↵ | |||
15 | session↵ | |||
16 | = openSession(); ↵ | 13 | s = openSession();↵ | |
17 | trans = session.beginTransaction(); ↵ | 14 | baz = (Baz) s.load( Baz.class, baz.getCode() );↵ | |
18 | session.delete( address ); ↵ | 15 | s.delete(baz);↵ | |
19 | session.delete( server ); ↵ | 16 | s.flush();↵ | |
20 | trans.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 | 8 |
Number of unmapped statements in the first code fragment | 11 |
Number of unmapped statements in the second code fragment | 9 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session session = openSession(); |
| 1 | Session s = openSession(); | |||||||||||||||||||||||||||
| 2 | Baz baz = new Baz(); | |||||||||||||||||||||||||||||
2 | Transaction trans = session.beginTransaction(); |
| | ||||||||||||||||||||||||||||
| 3 | Foo foo = new Foo(); | |||||||||||||||||||||||||||||
3 | ServerImpl server = new ServerImpl(); | | |||||||||||||||||||||||||||||
| 4 | List bag = new ArrayList(); | |||||||||||||||||||||||||||||
| 5 | bag.add(foo); | |||||||||||||||||||||||||||||
|
| 6 | baz.setIdFooBag(bag); | ||||||||||||||||||||||||||||
|
| 7 | baz.setFoo(foo); | ||||||||||||||||||||||||||||
4 | session.save(server); |
| 8 | s.save(baz); | |||||||||||||||||||||||||||
5 | AddressImpl address = new AddressImpl(); | | |||||||||||||||||||||||||||||
6 | server.setAddress(address); |
| | ||||||||||||||||||||||||||||
7 | address.setServer(server); |
| | ||||||||||||||||||||||||||||
8 | session.flush(); |
| 9 | s.flush(); | |||||||||||||||||||||||||||
9 | session.createQuery("from Server s join fetch s.address").list(); |
| | ||||||||||||||||||||||||||||
|
| 10 | s.connection().commit(); | ||||||||||||||||||||||||||||
10 | trans.commit(); |
| | ||||||||||||||||||||||||||||
11 | session.close(); |
| 11 | s.close(); | |||||||||||||||||||||||||||
12 | assertNotNull(server.getId()); | | |||||||||||||||||||||||||||||
13 | assertNotNull(address.getId()); | | |||||||||||||||||||||||||||||
14 | session = openSession(); |
| 12 | s = openSession(); | |||||||||||||||||||||||||||
|
| 13 | baz = (Baz)s.load(Baz.class, baz.getCode()); | ||||||||||||||||||||||||||||
15 | trans = session.beginTransaction(); |
| | ||||||||||||||||||||||||||||
16 | session.delete(address); |
| 15 | s.flush(); | |||||||||||||||||||||||||||
17 | session.delete(server); |
| 14 | s.delete(baz); | |||||||||||||||||||||||||||
|
| 16 | s.connection().commit(); | ||||||||||||||||||||||||||||
18 | trans.commit(); |
| | ||||||||||||||||||||||||||||
19 | session.close(); |
| 17 | s.close(); |
Row | Violation |
---|---|
1 | Unmatched statement Transaction trans=session.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement baz.setIdFooBag(bag); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement baz.setFoo(foo); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Type org.hibernate.test.abstractembeddedcomponents.propertyref.ServerImpl of variable server does not match with type org.hibernate.test.legacy.Baz of variable baz |
5 | Unmatched statement server.setAddress(address); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Unmatched statement address.setServer(server); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
7 | Unmatched statement session.createQuery("from Server s join fetch s.address").list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement s.connection().commit(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched statement trans.commit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
10 | Unmatched statement baz=(Baz)s.load(Baz.class,baz.getCode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
11 | Unmatched statement trans=session.beginTransaction(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Expression session.delete(address) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression session.delete(address) is a void method call, and thus it cannot be parameterized |
15 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
16 | Expression session.delete(address) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
17 | Expression s.flush() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression session.delete(address) is a void method call, and thus it cannot be parameterized |
19 | Expression s.flush() is a void method call, and thus it cannot be parameterized |
20 | Type org.hibernate.test.abstractembeddedcomponents.propertyref.ServerImpl of variable server does not match with type org.hibernate.test.legacy.Baz of variable baz |
21 | Unmatched statement s.connection().commit(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
22 | Unmatched statement trans.commit(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
23 | Clone fragment #1 returns variable session with type org.hibernate.Session , while Clone fragment #2 returns variable s with type org.hibernate.classic.Session |