users@glassfish.java.net

Re: [Fwd: _at_Embedded with _at_Overriding]

From: Mitesh Meswani <mitesh.meswani_at_oracle.com>
Date: Mon, 28 Feb 2011 17:24:08 -0800

I do not think it is legal to override mapping information for the use
case you describe. There is only one persistent attribute even when you
@override. Here is from the spec section 2.2

/
Entity subclasses may override the property accessor methods. However,
portable applications must not
override the object/relational mapping metadata that applies to the
persistent fields or properties of
entity superclasses.
/

What are you trying to model using @override?
>
> -------- Original Message --------
> Subject: @Embedded with @Overriding
> Date: Fri, 25 Feb 2011 20:33:30 +0100
> From: Olivier Chorier <lapsus63_at_gmail.com>
> Reply-To: users_at_glassfish.java.net
> To: users_at_glassfish.java.net
>
>
>
> Hi,
>
> Let's consider an embeddable class Address. I need to use it twice in
> an abstract class. So I need to override attributes with
> @AttributeOverrides.
> Everything is ok at this point.
>
> Now, I need to write a concrete class, but I need to change the
> @AttributeOverrides for this class (for compatibility reasons). I
> tried to @Override my getter end then re-writing my
> @AtttributOverrides, but the abstract declaration is used instead.
>
> Is it possible to define another attribute overriding in a concrete
> class when it has already been defined in the abstract one ?
>
> The problem is the same with the @Column anoation. I defined a name
> for my column in my abstract class, and in the concrete one, but the
> abstract definition was used instead of the concrete one.
>
> Thanks a lot for help.
>
> Olivier.
>
>