File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/cascade/CascadeTest.java | File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/cascade/CascadeTest.java | |||
Method name: void testOneToOneAssignedIds()
|
Method name: void testOneToOnePropertyRefAssignedIds()
|
|||
Number of AST nodes: 11 | Number of AST nodes: 11 | |||
1 | try {↵ | 1 | try {↵ | |
2 | Session s = openSession();↵ | 2 | Session s = openSession();↵ | |
3 | s.beginTransaction();↵ | 3 | s.beginTransaction();↵ | |
4 | ParentAssigned p = new ParentAssigned( new Long( 1 ), "parent" );↵ | 4 | ChildAssigned c2 = new ChildAssigned( new Long( 3 ), "c3" );↵ | |
5 | ParentInfoAssigned info = new ParentInfoAssigned( "something secret" );↵ | 5 | ChildInfoAssigned info = new ChildInfoAssigned( new Long( 4 ), "blah blah blah" );↵ | |
6 | p.setInfo( info );↵ | 6 | c2.setInfo( info );↵ | |
7 | info.setOwner( p );↵ | 7 | info.setOwner( c2 );↵ | |
8 | s.persist( p );↵ | 8 | s.persist( c2 );↵ | |
9 | try {↵ | 9 | try {↵ | |
10 | s.getTransaction().commit();↵ | 10 | s.getTransaction().commit();↵ | |
11 | fail( "expecting TransientObjectException on flush" );↵ | 11 | fail( "expecting TransientObjectException on flush" );↵ | |
12 | }↵ | 12 | }↵ | |
13 | catch( TransientObjectException e ) {↵ | 13 | catch( TransientObjectException e ) {↵ | |
14 | // expected result↵ | 14 | // expected result↵ | |
15 | log.trace( "handled expected exception", e );↵ | 15 | log.trace( "handled expected exception : " + e );↵ | |
16 | s.getTransaction().rollback();↵ | 16 | s.getTransaction().rollback();↵ | |
17 | }↵ | 17 | }↵ | |
18 | finally {↵ | 18 | finally {↵ | |
19 | s.close();↵ | 19 | s.close();↵ | |
20 | }↵ | 20 | }↵ | |
21 | }↵ | 21 | }↵ | |
22 | finally {↵ | 22 | finally {↵ | |
23 | cleanupData();↵ | 23 | cleanupData();↵ | |
24 | } | 24 |
| |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 73 |
Number of mapped statements | 9 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 8.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | try | 1 | try | |||||||||||||||||||
2 | Session s = openSession(); | 2 | Session s = openSession(); | |||||||||||||||||||
3 | s.beginTransaction(); | 3 | s.beginTransaction(); | |||||||||||||||||||
|
| 4 | ChildAssigned c2 = new ChildAssigned(new Long(3), "c3"); | |||||||||||||||||||
4 | ParentAssigned p = new ParentAssigned(new Long(1), "parent"); |
| | |||||||||||||||||||
|
| 5 | ChildInfoAssigned info = new ChildInfoAssigned(new Long(4), "blah blah blah"); | |||||||||||||||||||
5 | ParentInfoAssigned info = new ParentInfoAssigned("something secret"); |
| | |||||||||||||||||||
6 | p.setInfo(info); |
| 6 | c2.setInfo(info); | ||||||||||||||||||
7 | info.setOwner(p); |
| 7 | info.setOwner(c2); | ||||||||||||||||||
8 | s.persist(p); |
| 8 | s.persist(c2); | ||||||||||||||||||
9 | try |
| 9 | try | ||||||||||||||||||
10 | s.getTransaction().commit(); | 10 | s.getTransaction().commit(); | |||||||||||||||||||
11 | fail("expecting TransientObjectException on flush"); | 11 | fail("expecting TransientObjectException on flush"); |
Row | Violation |
---|---|
1 | Unmatched statement ChildAssigned c2=new ChildAssigned(new Long(3),"c3"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement ParentAssigned p=new ParentAssigned(new Long(1),"parent"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Unmatched statement ChildInfoAssigned info=new ChildInfoAssigned(new Long(4),"blah blah blah"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
4 | Unmatched statement ParentInfoAssigned info=new ParentInfoAssigned("something secret"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Type org.hibernate.test.jpa.cascade.ParentInfoAssigned of variable info does not match with type org.hibernate.test.jpa.cascade.ChildInfoAssigned of variable info |
6 | Type org.hibernate.test.jpa.cascade.ParentAssigned of variable p does not match with type org.hibernate.test.jpa.cascade.ChildAssigned of variable c2 |
7 | Type org.hibernate.test.jpa.cascade.ParentAssigned of variable p does not match with type org.hibernate.test.jpa.cascade.ChildAssigned of variable c2 |
8 | Type org.hibernate.test.jpa.cascade.ParentInfoAssigned of variable info does not match with type org.hibernate.test.jpa.cascade.ChildInfoAssigned of variable info |
9 | Type org.hibernate.test.jpa.cascade.ParentAssigned of variable p does not match with type org.hibernate.test.jpa.cascade.ChildAssigned of variable c2 |
10 | Expression log.trace("handled expected exception",e) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression log.trace("handled expected exception : " + e) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression log.trace("handled expected exception",e) is a void method call, and thus it cannot be parameterized |
13 | Expression log.trace("handled expected exception : " + e) is a void method call, and thus it cannot be parameterized |