liquidform - Language Integrated QUeries For ORM
http://code.google.com/p/liquidform/ is a libray that adds a DSL on top of JPA. In particular, the DSL allows for queries to use domain objects in a typesafe manner. for example:
List people = em.createQuery(
"SELECT FROM Person p WHERE p.surname LIKE 'Smith%'")
.getResultList();
becomes (notice the use of p.getSurname() for type safety on Person methods)
Person p = LiquidForm.use(Person.class, "p");
List people2 = em.createQuery(
select(p).from(Person.class).as(p).where(like(p.getSurname(), "Smith%")).toString()).getResultList();
