我正在寻找一种方法来在运行时获取有关我的hibernate实体类的信息。 详细地说,我需要像这样的信息
ABC类具有属性a,b和c,c是列表和与XYZ类的关联
为了上课
public class ABC { private int a; private String b; @OneToMany Private List<XYZ> c; }运行时需要的一切。 我确信Hibernate在运行时知道所有这些,但我不知道如何获取这些信息。
I am seeking a way to get information about my hibernate entity classes at runtime. In detail I would need information like
Class ABC has the properties a, b and c with c being a list and association to class XYZ
for the class
public class ABC { private int a; private String b; @OneToMany Private List<XYZ> c; }All that is needed at runtime. I am sure Hibernate knows all that at runtime, but I am not aware how to get these information.
最满意答案
PersistentClass userMapping = cfg.getClassMapping(ABC.class);cfg是Hibernate Configuration的一个实例。
PersistentClass拥有您需要的所有信息。
PersistentClass userMapping = cfg.getClassMapping(ABC.class);cfg is an instance of Hibernate Configuration.
PersistentClass has all the info you need.
更多推荐
ABC,hibernate,电脑培训,计算机培训,IT培训"/> <meta name="description&quo
发布评论