Use polymorphism in jpa