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