Improving Security and JPA support