[#1765] make more generic so it now works with normal hibernate entities as well as JPABase