Code cleanup, improve JPA performance by narrowing the id search to a table