Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] JPA: Override a property attribute in a subclass

Hi,

I have a subclass of a JPA entity, superclass that I cannot modify, but I 
need to mark some fields (in the subclass) with: 

@Column(updatable = false, insertable = false)

because I need to use another property in the subclass that manage this 
field, but I cannot modify the superclass to make it to add 
@MappedSuperclass.

I have tried adding @AttributeOverride annotation in the subclass like this:

@AttributeOverride(name = "paisDespacho", column = @Column(name = 
"PaisDespacho", updatable = false, insertable = false))

But it seems that do nothing, when I run the application the exception says:

...
Exception [EclipseLink-48] (Eclipse Persistence Services - 1.0.1 (Build
20080905)): org.eclipse.persistence.exceptions.DescriptorException
Exception Description: Multiple writable mappings exist for the field
[FASTTRACK2.Despachos.PaisDespacho].  Only one may be defined as writable,
all others must be specified read-only.
...


"PaisDespacho" is a field with a propery named "paisDespacho" in the 
superclass with type "String", but in the subclass I need to create a new 
property that manage this field with type "Paises" (mappet to another 
entity).

I cannot have access to modify the superclass.

Please help.

Thanks.

xavier.
-- 
View this message in context: http://www.nabble.com/JPA%3A-Override-a-property-attribute-in-a-subclass-tp24975448p24975448.html
Sent from the EclipseLink - Users mailing list archive at Nabble.com.



Back to the top