如何获得在EJB3(JPA)与@Id注释的领域和Hibernate? [英] How to get the field annotated with @Id in EJB3 (JPA) and Hibernate?

查看:167
本文介绍了如何获得在EJB3(JPA)与@Id注释的领域和Hibernate?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

标题是自我解释。

我会很高兴听到的​​解决方案,谢谢。

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)与@Id注释的领域和Hibernate?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆