Shortening JPA criteria query boilerplate
JPA Criteria API is horrific, even the creators admitted that it was designed for tooling support rather than for developers.
My personal favorite approach is to use a fluent query API like QueryDSL. 

The query in QueryDSL would look more or less as follows:

new JPAQuery().from(transaction)
    .where(transaction.originalOperationId.eq(originalOperationId))
   .list();


The difference is staggering. And the query is fully typesafe.