File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
ebean-test/src/test/java/org/tests/basic Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -97,17 +97,22 @@ public void testConcurrentForUpdate() throws InterruptedException {
9797
9898 ResetBasicData .reset ();
9999
100+ Database db = DB .getDefault ();
100101 Thread t1 = new Thread () {
101102 @ Override
102103 public void run () {
103- try (final Transaction transaction = DB .createTransaction ()) {
104+ try (final Transaction transaction = db .createTransaction ()) {
104105 log .info ("Thread: before find" );
105- DB .find (Customer .class )
106+ List < Customer > list = DB .find (Customer .class )
106107 .usingTransaction (transaction )
107108 .forUpdate ()
108- // .orderBy().desc("1") // this would help by the locks in DB2
109+ // .orderBy().desc("1") // this would help by the locks in DB2
109110 .findList ();
110111
112+ Customer first = list .get (0 );
113+ db .markAsDirty (first );
114+ db .save (first , transaction );
115+
111116 log .info ("Thread: after find" );
112117 try {
113118 Thread .sleep (3000 );
@@ -124,7 +129,7 @@ public void run() {
124129 Thread .sleep (300 );
125130
126131 long start = System .currentTimeMillis ();
127- try (final Transaction transaction = DB .beginTransaction ()) {
132+ try (final Transaction transaction = db .beginTransaction ()) {
128133 if (isH2 ()) {
129134 DB .sqlUpdate ("SET LOCK_TIMEOUT 5000" ).execute ();
130135 }
You can’t perform that action at this time.
0 commit comments