return result;
}
@Transactional
public void storePlay(long pieceId, Long userId, String ip, boolean mobileApp) {
PiecePlay play = new PiecePlay();
play.setDateTime(new DateTime());
play.setMobileApp(mobileApp);
if (userId != null) {
play.setUser(dao.getById(User.class, userId));
}
Piece piece = dao.getById(Piece.class, pieceId);
play.setPiece(piece);
play.setIp(ip);
dao.persist(play);
if (piece.isNewlyCreated()) {
// we don't care about isolation here - 2 or more users can get (and
// set new=false to) the same piece and that's OK