如何在 EJB3 (JPA) 和 Hibernate 中使用@Id 注释字段? [英] How to get the field annotated with @Id in EJB3 (JPA) and Hibernate?
本文介绍了如何在 EJB3 (JPA) 和 Hibernate 中使用@Id 注释字段?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
标题是不言自明的.
我很高兴听到解决方案,谢谢.
I would be glad to hear solutions, thanks.
推荐答案
有一种比目前列出的更短的方法:
There's a shorter approach than listed so far:
Reflections r = new Reflections(this.getClass().getPackage().getName());
Set<Field> fields = r.getFieldsAnnotatedWith(Id.class);
这篇关于如何在 EJB3 (JPA) 和 Hibernate 中使用@Id 注释字段?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文