File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/propertyref/inheritence/union/UnionSubclassPropertyRefTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/propertyref/inheritence/discrim/SubclassPropertyRefTest.java | |||
Method name: void testOneToOnePropertyRef()
|
Method name: void testOneToOnePropertyRef()
|
|||
Number of AST nodes: 29 | Number of AST nodes: 29 | |||
1 | Session s = openSession();↵ | 1 | Session s = openSession();↵ | |
2 | Transaction t = s.beginTransaction();↵ | 2 | Transaction t = s.beginTransaction();↵ | |
3 | Customer c = new Customer();↵ | 3 | Customer c = new Customer();↵ | |
4 | c.setName( "Emmanuel" );↵ | 4 | c.setName( "Emmanuel" );↵ | |
5 | c.setCustomerId( "C123-456" );↵ | 5 | c.setCustomerId( "C123-456" );↵ | |
6 | c.setPersonId( "P123-456" );↵ | 6 | c.setPersonId( "P123-456" );↵ | |
7 | Account a = new Account();↵ | 7 | Account a = new Account();↵ | |
8 | a.setCustomer( c );↵ | 8 | a.setCustomer( c );↵ | |
9 | a.setPerson( c );↵ | 9 | a.setPerson( c );↵ | |
10 | a.setType( 'X' );↵ | 10 | a.setType( 'X' );↵ | |
11 | s.persist( c );↵ | 11 | s.persist( c );↵ | |
12 | s.persist( a );↵ | 12 | s.persist( a );↵ | |
13 | t.commit();↵ | 13 | t.commit();↵ | |
14 | s.close();↵ | 14 | s.close();↵ | |
15 | s = openSession();↵ | 15 | s = openSession();↵ | |
16 | t = s.beginTransaction();↵ | 16 | t = s.beginTransaction();↵ | |
17 | a = ( Account ) s.createQuery( "from Account acc join fetch acc.customer join fetch acc.person" )↵ | 17 | a = ( Account ) s.createQuery( "from Account acc join fetch acc.customer join fetch acc.person" )↵ | |
18 | .uniqueResult();↵ | 18 | .uniqueResult();↵ | |
19 | assertNotNull( a.getCustomer() );↵ | 19 | assertNotNull( a.getCustomer() );↵ | |
20 | assertTrue( Hibernate.isInitialized( a.getCustomer() ) );↵ | 20 | assertTrue( Hibernate.isInitialized( a.getCustomer() ) );↵ | |
21 | assertNotNull( a.getPerson() );↵ | 21 | assertNotNull( a.getPerson() );↵ | |
22 | assertTrue( Hibernate.isInitialized( a.getPerson() ) );↵ | 22 | assertTrue( Hibernate.isInitialized( a.getPerson() ) );↵ | |
23 | c = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();↵ | 23 | c = ( Customer ) s.createQuery( "from Customer" ).uniqueResult();↵ | |
24 | assertSame( c, a.getCustomer() );↵ | 24 | assertSame( c, a.getCustomer() );↵ | |
25 | assertSame( c, a.getPerson() );↵ | 25 | assertSame( c, a.getPerson() );↵ | |
26 | s.delete( a );↵ | 26 | s.delete( a );↵ | |
27 | s.delete( a.getCustomer() );↵ | 27 | s.delete( a.getCustomer() );↵ | |
28 | s.delete( a.getPerson() );↵ | 28 | s.delete( a.getPerson() );↵ | |
29 | t.commit();↵ | 29 | t.commit();↵ | |
30 | s.close(); | 30 |
| |
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 | 406 |
Number of mapped statements | 25 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 4 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Session s = openSession(); | 1 | Session s = openSession(); | ||||||||||||||||||
2 | Transaction t = s.beginTransaction(); | 2 | Transaction t = s.beginTransaction(); | ||||||||||||||||||
| 3 | Customer c = new Customer(); | |||||||||||||||||||
3 | Customer c = new Customer(); | | |||||||||||||||||||
4 | c.setName("Emmanuel"); |
| 4 | c.setName("Emmanuel"); | |||||||||||||||||
5 | c.setCustomerId("C123-456"); |
| 5 | c.setCustomerId("C123-456"); | |||||||||||||||||
6 | c.setPersonId("P123-456"); |
| 6 | c.setPersonId("P123-456"); | |||||||||||||||||
| 7 | Account a = new Account(); | |||||||||||||||||||
7 | Account a = new Account(); | | |||||||||||||||||||
8 | a.setCustomer(c); |
| 8 | a.setCustomer(c); | |||||||||||||||||
9 | a.setPerson(c); |
| 9 | a.setPerson(c); | |||||||||||||||||
10 | a.setType('X'); |
| 10 | a.setType('X'); | |||||||||||||||||
11 | s.persist(c); |
| 11 | s.persist(c); | |||||||||||||||||
12 | s.persist(a); |
| 12 | s.persist(a); | |||||||||||||||||
13 | t.commit(); | 13 | t.commit(); | ||||||||||||||||||
14 | s.close(); | 14 | s.close(); | ||||||||||||||||||
15 | s = openSession(); | 15 | s = openSession(); | ||||||||||||||||||
16 | t = s.beginTransaction(); | 16 | t = s.beginTransaction(); | ||||||||||||||||||
|
| 17 | a = (Account)s.createQuery("from Account acc join fetch acc.customer join fetch acc.person").uniqueResult(); | ||||||||||||||||||
17 | a = (Account)s.createQuery("from Account acc join fetch acc.customer join fetch acc.person").uniqueResult(); |
| | ||||||||||||||||||
18 | assertNotNull(a.getCustomer()); |
| 18 | assertNotNull(a.getCustomer()); | |||||||||||||||||
19 | assertTrue(Hibernate.isInitialized(a.getCustomer())); |
| 19 | assertTrue(Hibernate.isInitialized(a.getCustomer())); | |||||||||||||||||
20 | assertNotNull(a.getPerson()); |
| 20 | assertNotNull(a.getPerson()); | |||||||||||||||||
21 | assertTrue(Hibernate.isInitialized(a.getPerson())); |
| 21 | assertTrue(Hibernate.isInitialized(a.getPerson())); | |||||||||||||||||
|
| 22 | c = (Customer)s.createQuery("from Customer").uniqueResult(); | ||||||||||||||||||
22 | c = (Customer)s.createQuery("from Customer").uniqueResult(); |
| | ||||||||||||||||||
23 | assertSame(c, a.getCustomer()); |
| 23 | assertSame(c, a.getCustomer()); | |||||||||||||||||
24 | assertSame(c, a.getPerson()); |
| 24 | assertSame(c, a.getPerson()); | |||||||||||||||||
25 | s.delete(a); |
| 25 | s.delete(a); | |||||||||||||||||
26 | s.delete(a.getCustomer()); |
| 26 | s.delete(a.getCustomer()); | |||||||||||||||||
27 | s.delete(a.getPerson()); |
| 27 | s.delete(a.getPerson()); | |||||||||||||||||
28 | t.commit(); | 28 | t.commit(); | ||||||||||||||||||
29 | s.close(); | 29 | s.close(); |
Row | Violation |
---|---|
1 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
2 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
3 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
4 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
5 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
6 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
7 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
8 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
9 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
10 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
11 | Unmatched statement a=(Account)s.createQuery("from Account acc join fetch acc.customer join fetch acc.person").uniqueResult(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
12 | Unmatched statement a=(Account)s.createQuery("from Account acc join fetch acc.customer join fetch acc.person").uniqueResult(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
13 | Expression a.getCustomer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression a.getCustomer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable a.getCustomer() does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable a.getCustomer() |
16 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
17 | Expression a.getCustomer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression a.getCustomer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable a.getCustomer() does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable a.getCustomer() |
20 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
21 | Expression a.getPerson() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
22 | Expression a.getPerson() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
23 | Type org.hibernate.test.propertyref.inheritence.union.Person of variable a.getPerson() does not match with type org.hibernate.test.propertyref.inheritence.discrim.Person of variable a.getPerson() |
24 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
25 | Expression a.getPerson() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
26 | Expression a.getPerson() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
27 | Type org.hibernate.test.propertyref.inheritence.union.Person of variable a.getPerson() does not match with type org.hibernate.test.propertyref.inheritence.discrim.Person of variable a.getPerson() |
28 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
29 | Unmatched statement c=(Customer)s.createQuery("from Customer").uniqueResult(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
30 | Unmatched statement c=(Customer)s.createQuery("from Customer").uniqueResult(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
31 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
32 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable c does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable c |
33 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
34 | Expression a.getCustomer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
35 | Expression a.getCustomer() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
36 | Type org.hibernate.test.propertyref.inheritence.union.Customer of variable a.getCustomer() does not match with type org.hibernate.test.propertyref.inheritence.discrim.Customer of variable a.getCustomer() |
37 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |
38 | Expression a.getPerson() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
39 | Expression a.getPerson() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
40 | Type org.hibernate.test.propertyref.inheritence.union.Person of variable a.getPerson() does not match with type org.hibernate.test.propertyref.inheritence.discrim.Person of variable a.getPerson() |
41 | Type org.hibernate.test.propertyref.inheritence.union.Account of variable a does not match with type org.hibernate.test.propertyref.inheritence.discrim.Account of variable a |