In Play! if you call this:
void method()
{
User u = User();
u.name = \"bob\";
u.save();
while(true){/* endless loop */}
}
Nothing will actually
As already said by Andrei Bodnarescu, you can use JPA.em().flush()
or User.em().flush()
to flush persistence context explicitly.
Note, however, that doing so won't make the saved entity immediately available to other transactions, since the current transaction should be committed first. You can commit the current transaction as JPA.em().getTransaction().commit()
.