【问题标题】:Hyperjaxb/lombok : how to force Hyperjaxb generate annotations mapping on attributes and not on the methods?Hyperjaxb/lombok:如何强制 Hyperjaxb 在属性而不是方法上生成注释映射?
【发布时间】:2013-04-22 12:23:41
【问题描述】:

我想在我的属性上添加 jpa 注释,而不是在 getter 和 setter 上。可以为此配置hyperjaxb吗?

我想要这个,因为我使用 lombok 是为了避免 getter 和 setter 代码,并且在属性上方有“@getter”“@setter”。

谢谢

【问题讨论】:

    标签: attributes annotations lombok hyperjaxb


    【解决方案1】:

    目前不支持开箱即用(如果您需要此功能,请提出问题)。

    但是,您可以通过编写并覆盖您自己的 org.jvnet.hyperjaxb3.ejb.strategy.annotate.AnnotateOutline 实现来实现。有关覆盖策略的示例,请参见 https://svn.java.net/svn/hj3~svn/trunk/ejb/tests/custom-naming/

    但请注意,Hyperjaxb 必须使用 getter/setter 来解决一些 JAXB/JPA 不兼容问题(例如 JPA 不支持的简单类型)。如果您在字段上添加注释,这将不起作用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-03
      • 1970-01-01
      • 1970-01-01
      • 2014-12-03
      相关资源
      最近更新 更多