File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
frameworks/Java/ninja-standalone/src/main/java/controllers Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1010
1111import com .google .inject .Inject ;
1212import com .google .inject .Singleton ;
13+ import com .google .inject .persist .Transactional ;
1314import ninja .jpa .UnitOfWork ;
1415import ninja .params .Param ;
1516
@@ -62,12 +63,17 @@ public Result update(@Param("queries") Integer queries) {
6263 // now update stuff:
6364 for (World world : worlds ) {
6465 world .randomNumber = ThreadLocalRandom .current ().nextInt (DB_ROWS ) + 1 ;
65- worldDao . put (world );
66+ this . updateWorld (world );
6667 }
6768
6869 return Results .json ().render (worlds );
6970 }
7071
72+ @ Transactional
73+ public void updateWorld (World world ) {
74+ worldDao .put (world );
75+ }
76+
7177 private World getRandomWorld () {
7278 return worldDao .get (ThreadLocalRandom .current ().nextInt (DB_ROWS ) + 1 );
7379 }
You can’t perform that action at this time.
0 commit comments