users@glassfish.java.net

Re: Overriding a column name in an Embedded

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Mon, 06 Aug 2007 23:31:24 -0700

Benjamin,

Look at the example in the spec section 9.1.11 - it uses @AttributeOverrides on
the @Embedded property, not on the definition of the @Embeddable itself (which
make sense, right?).

thanks,
-marina

Benjamin Renaud wrote:
>
> I am trying to override the name of a generated column in Glassfish
> using the @AttributeOverrides syntax:
>
> @Embeddable
> @AttributeOverrides({
> @AttributeOverride(name="emailAddress",
> column=_at_Column(name="email_address")),
> @AttributeOverride(name="mobileNumber",
> column=_at_Column(name="mobile_number")),
> @AttributeOverride(name="timeZoneId",
> column=_at_Column(name="time_zone_id")),
> @AttributeOverride(name="listSortOrder",
> column=_at_Column(name="list_sort_order")),
> @AttributeOverride(name="hasAppInstalled",
> column=_at_Column(name="has_app_installed")),
> @AttributeOverride(name="compactView",
> column=_at_Column(name="compact_view"))
> })
> public class UserPreferences {
>
> private String emailAddress;
> private String mobileNumber;
> private String timeZoneId;
> private ListSortOrder listSortOrder;
> private boolean hasAppInstalled = false;
> private boolean compactView = true;
>
> etc.
>
> It does not seem to work. The column generated are "emailaddress"
> "compactview" and so on.
>
> Am I doing something wrong or if this is a known issue?
>
> Thanks!
> Benjamin