在运行时获取有关entites的休眠信息 [英] Getting hibernate information about entites at runtime
问题描述
我正在寻求一种在运行时获取有关我的hibernate实体类的信息的方法。详细我需要的信息,如$ / b>
ABC类具有属性a,b和c,其中c是
列表和关联给班级XYZ
给班级
public class ABC {
private int a;
私人字符串b;
@OneToMany
私人清单< XYZ> C;
}
运行时需要的全部内容。我确信Hibernate在运行时知道所有这些信息,但我不知道如何获得这些信息。
PersistentClass userMapping = cfg.getClassMapping(ABC.class);
cfg是Hibernate Configuration的一个实例。
PersistentClass 包含所有信息你需要。
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 is an instance of Hibernate Configuration.
PersistentClass has all the info you need.
这篇关于在运行时获取有关entites的休眠信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!