0
我使用的Eclipse 2.5.2的链接,我有以下的继承结构:JPA使用@AttributeOverride为继承地图
@MappedSuperclass
public abstract class LocalizedEntity {
/**
* {@link Map} containing the String localized values.
*/
@ElementCollection
protected Map<LocalizedField, String> l10nValues = new HashMap<LocalizedField, String>();
...
在扩展类,我试图改变长为“价值”列的地图。
@AttributeOverride(name="l10nValues.value", [email protected](length=2048))
public class MyClass extends LocalizedEntity
但我得到了以下错误:
Internal Exception: Exception [EclipseLink-7200] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The attribute [value] was not found on the embeddable class [class com.thedigitalstack.model.l10n.LocalizedField]. It is referenced in an attribute override for the embedded attribute [l10nValues] on class [class com.finantix.agent.core.SectionContent].
javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [[email protected]] failed.
Internal Exception: Exception [EclipseLink-7200] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.ValidationException
看来,日食链接试图只浏览低谷地图的“关键”的一部分。实际上,“l10nValues”的“关键”是“LocalizedField”类型的对象。 价值端是一个简单的字符串:如何浏览该值以改变其长度?
谢谢
LocalizedField类定义为@Embeddable。这个类定义了我的地图的关键部分,但我想访问值。
@Embeddable
public final class LocalizedField implements Serializable{
如何定义LocalizedField类? – wypieprz 2015-03-13 14:16:45
wipieprz:LocalizedField被定义为@Embeddable – egesuato 2015-03-13 14:34:21
...以及用作映射关键字的可嵌入类中字段的名称是什么? – wypieprz 2015-03-13 14:40:43