Commit 979f2ef 1 parent 1cee232 commit 979f2ef Copy full SHA for 979f2ef
File tree 1 file changed +7
-1
lines changed
frameworks/Java/ninja-standalone/src/main/java/controllers
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 10
10
11
11
import com .google .inject .Inject ;
12
12
import com .google .inject .Singleton ;
13
+ import com .google .inject .persist .Transactional ;
13
14
import ninja .jpa .UnitOfWork ;
14
15
import ninja .params .Param ;
15
16
@@ -62,12 +63,17 @@ public Result update(@Param("queries") Integer queries) {
62
63
// now update stuff:
63
64
for (World world : worlds ) {
64
65
world .randomNumber = ThreadLocalRandom .current ().nextInt (DB_ROWS ) + 1 ;
65
- worldDao . put (world );
66
+ this . updateWorld (world );
66
67
}
67
68
68
69
return Results .json ().render (worlds );
69
70
}
70
71
72
+ @ Transactional
73
+ public void updateWorld (World world ) {
74
+ worldDao .put (world );
75
+ }
76
+
71
77
private World getRandomWorld () {
72
78
return worldDao .get (ThreadLocalRandom .current ().nextInt (DB_ROWS ) + 1 );
73
79
}
You can’t perform that action at this time.
0 commit comments