Add suport for composite and sorting to JPA (not yet complete)