How to know if a class is an @Entity (javax.persistence.Entity)?
问题 How can I know if a class is annotated with javax.persistence.Entity ? Person (Entity) @Entity @Table(name = "t_person") public class Person { ... } PersonManager @Stateless public class PersonManager { @PersistenceContext protected EntityManager em; public Person findById(int id) { Person person = this.em.find(Person.class, id); return person; } I try to do it with instance of as the following @Inject PersonManager manager; Object o = manager.findById(1); o instanceof Entity // false however