我正在使用eclipse链接2.5.2,并且具有以下继承结构:
@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", column=@Column(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 [com.finantix.agent.core.model@HK] failed.
Internal Exception: Exception [EclipseLink-7200] (Eclipse Persistence Services - 2.5.2.v20131113-a7346c6): org.eclipse.persistence.exceptions.ValidationException
似乎eclipse链接仅尝试浏览地图的“关键”部分。实际上,“键”的值为“ l10nValues”是“ LocalizedField”类型的对象。
值方是一个简单的String:如何在值中导航以更改其长度?
谢谢
LocalizedField类定义为@Embeddable。此类定义了地图的关键部分,但我想访问值一。
@Embeddable
public final class LocalizedField implements Serializable{
最佳答案
答案是将@AttributeOverride与“ value.l10nValues”一起使用。由于某种原因,它可以在countrary上运行。