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 24
24
package org .hibernate .test .instrument .buildtime ;
25
25
26
26
import org .junit .Test ;
27
-
28
27
import org .hibernate .bytecode .instrumentation .internal .FieldInterceptionHelper ;
29
28
import org .hibernate .test .instrument .cases .Executable ;
30
29
import org .hibernate .test .instrument .cases .TestCustomColumnReadAndWrite ;
31
30
import org .hibernate .test .instrument .cases .TestDirtyCheckExecutable ;
32
31
import org .hibernate .test .instrument .cases .TestFetchAllExecutable ;
33
32
import org .hibernate .test .instrument .cases .TestInjectFieldInterceptorExecutable ;
34
33
import org .hibernate .test .instrument .cases .TestIsPropertyInitializedExecutable ;
34
+ import org .hibernate .test .instrument .cases .TestLazyBasicPropertyUpdateExecutable ;
35
35
import org .hibernate .test .instrument .cases .TestLazyExecutable ;
36
36
import org .hibernate .test .instrument .cases .TestLazyManyToOneExecutable ;
37
37
import org .hibernate .test .instrument .cases .TestLazyPropertyCustomTypeExecutable ;
@@ -89,6 +89,11 @@ public void testLazyPropertyCustomTypeExecutable() throws Exception {
89
89
execute ( new TestLazyPropertyCustomTypeExecutable () );
90
90
}
91
91
92
+ @ Test
93
+ public void testLazyBasicPropertyUpdate () throws Exception {
94
+ execute ( new TestLazyBasicPropertyUpdateExecutable () );
95
+ }
96
+
92
97
@ Test
93
98
public void testSharedPKOneToOne () throws Exception {
94
99
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 @@ -123,6 +123,11 @@ public void testLazyPropertyCustomType() {
123
123
executeExecutable ( "org.hibernate.test.instrument.cases.TestLazyPropertyCustomTypeExecutable" );
124
124
}
125
125
126
+ @ Test
127
+ public void testLazyBasicPropertyUpdate () {
128
+ executeExecutable ( "org.hibernate.test.instrument.cases.TestLazyBasicPropertyUpdateExecutable" );
129
+ }
130
+
126
131
@ Test
127
132
public void testSharedPKOneToOne () {
128
133
executeExecutable ( "org.hibernate.test.instrument.cases.TestSharedPKOneToOneExecutable" );
You can’t perform that action at this time.
0 commit comments