Eclipselink 混合注释和 xml
Eclipselink mixing annotation and xml
我的目标是在 eclipselink-orm.xml 中保存一些转换器和命名查询声明。并在实体实现中使用注释@convert,在 EJB 中调用命名查询。
列表项:<converter name="date-time-converter" class="domaine.dateTimeConverter/>
注解@convert("date-time-converter")
eclipse 向我显示错误:注释类型 Convert
的属性值未定义
如何实现?
注释 @Convert
没有属性“value”。您需要定义“converter”属性,如
@Convert(converter=DateTimeConverter.class)
MyDateTime dateTime;
根据 javadocs for JPA 2.1. You can see use of JPA AttributeConverter on this link。 @Converter
是定义是否自动应用。如果是这样,那么您不需要针对字段的 @Convert
。如果使用 orm.xml
,同样适用
我的目标是在 eclipselink-orm.xml 中保存一些转换器和命名查询声明。并在实体实现中使用注释@convert,在 EJB 中调用命名查询。
列表项:
<converter name="date-time-converter" class="domaine.dateTimeConverter/>
注解
@convert("date-time-converter")
eclipse 向我显示错误:注释类型 Convert
的属性值未定义如何实现?
注释 @Convert
没有属性“value”。您需要定义“converter”属性,如
@Convert(converter=DateTimeConverter.class)
MyDateTime dateTime;
根据 javadocs for JPA 2.1. You can see use of JPA AttributeConverter on this link。 @Converter
是定义是否自动应用。如果是这样,那么您不需要针对字段的 @Convert
。如果使用 orm.xml