File tree Expand file tree Collapse file tree 3 files changed +52
-1
lines changed
hibernate-core/src/test/java/org/hibernate/test/instrument Expand file tree Collapse file tree 3 files changed +52
-1
lines changed Original file line number Diff line number Diff line change 7
7
package org .hibernate .test .instrument .buildtime ;
8
8
9
9
import org .junit .Test ;
10
-
11
10
import org .hibernate .bytecode .instrumentation .internal .FieldInterceptionHelper ;
12
11
import org .hibernate .test .instrument .cases .Executable ;
13
12
import org .hibernate .test .instrument .cases .TestCustomColumnReadAndWrite ;
14
13
import org .hibernate .test .instrument .cases .TestDirtyCheckExecutable ;
15
14
import org .hibernate .test .instrument .cases .TestFetchAllExecutable ;
16
15
import org .hibernate .test .instrument .cases .TestInjectFieldInterceptorExecutable ;
17
16
import org .hibernate .test .instrument .cases .TestIsPropertyInitializedExecutable ;
17
+ import org .hibernate .test .instrument .cases .TestLazyBasicPropertyUpdateExecutable ;
18
18
import org .hibernate .test .instrument .cases .TestLazyExecutable ;
19
19
import org .hibernate .test .instrument .cases .TestLazyManyToOneExecutable ;
20
20
import org .hibernate .test .instrument .cases .TestLazyPropertyCustomTypeExecutable ;
@@ -72,6 +72,11 @@ public void testLazyPropertyCustomTypeExecutable() throws Exception {
72
72
execute ( new TestLazyPropertyCustomTypeExecutable () );
73
73
}
74
74
75
+ @ Test
76
+ public void testLazyBasicPropertyUpdate () throws Exception {
77
+ execute ( new TestLazyBasicPropertyUpdateExecutable () );
78
+ }
79
+
75
80
@ Test
76
81
public void testSharedPKOneToOne () throws Exception {
77
82
execute ( new TestSharedPKOneToOneExecutable () );
Original file line number Diff line number Diff line change
1
+ package org .hibernate .test .instrument .cases ;
2
+ import org .junit .Assert ;
3
+
4
+ import org .hibernate .Hibernate ;
5
+ import org .hibernate .Session ;
6
+ import org .hibernate .Transaction ;
7
+ import org .hibernate .test .instrument .domain .Document ;
8
+ import org .hibernate .test .instrument .domain .Folder ;
9
+ import org .hibernate .test .instrument .domain .Owner ;
10
+
11
+ /**
12
+ * @author Andrei Ivanov
13
+ */
14
+ public class TestLazyBasicPropertyUpdateExecutable extends AbstractExecutable {
15
+ public void execute () {
16
+ Session s = getFactory ().openSession ();
17
+ Transaction t = s .beginTransaction ();
18
+ Owner o = new Owner ();
19
+ Document doc = new Document ();
20
+ Folder fol = new Folder ();
21
+ o .setName ("gavin" );
22
+ doc .setName ("Hibernate in Action" );
23
+ doc .setSummary ("blah" );
24
+ doc .updateText ("blah blah" );
25
+ fol .setName ("books" );
26
+ doc .setOwner (o );
27
+ doc .setFolder (fol );
28
+ fol .getDocuments ().add (doc );
29
+ Assert .assertTrue ( Hibernate .isPropertyInitialized ( doc , "summary" ) );
30
+ s .persist (o );
31
+ s .persist (fol );
32
+ t .commit ();
33
+
34
+ s .evict (doc );
35
+
36
+ doc .setSummary ("u" );
37
+ s .merge (doc );
38
+
39
+ s .close ();
40
+ }
41
+ }
Original file line number Diff line number Diff line change @@ -115,6 +115,11 @@ public void testLazyPropertyCustomType() {
115
115
executeExecutable ( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
116
116
}
117
117
118
+ @ Test
119
+ public void testLazyBasicPropertyUpdate () {
120
+ executeExecutable ( "org.hibernate.test.instrument.cases.TestLazyBasicPropertyUpdateExecutable" );
121
+ }
122
+
118
123
@ Test
119
124
public void testSharedPKOneToOne () {
120
125
executeExecutable ( "org.hibernate.test.instrument.cases.TestSharedPKOneToOneExecutable" );
You can’t perform that action at this time.
0 commit comments