persistence@glassfish.java.net

RE: [Fwd: [Issue 486] Problem with abstract _at_Entity and _at_Id in b41]

From: Mike Keith <michael.keith_at_oracle.com>
Date: Wed, 29 Mar 2006 20:26:11 -0500

Actually, I can see exactly why there is confusion. I have always
assumed that the @Inheritance annotation is present and in the spec we
do not use the wording that we use in the other sections that assume
a default when the annotation is absent.

For example, in every section where the annotation may be defaulted
if it is absent we say:

"If no <InsertAnnotationHere> annotation is specified, ..."
"If the <InsertAnnotationHere> annotation is not specified..."
"If the <InsertAnnotationHere> annotation is missing..."

We say this for:

@Table - "If no Table annotation is specified..."
@SecondaryTable - "If no SecondaryTable annotation is specified..."
@Column - "If no Column annotation is specified..."
@JoinColumn - "If no JoinColumn annotation is specified..."
@JoinTable - "If the JoinTable annotation is missing..."

And for the two inheritance annotations that *are* optional:

@DiscriminatorColumn - "If the DiscriminatorColumn annotation is missing..."
@DiscriminatorValue - "If the DiscriminatorValue annotation is not specified..."

But in the Inheritance section, we define the enum, and then talk about
the *type* (the thing in the annotation element) being specified, not the
annotation:

"public enum InheritanceType
{ SINGLE_TABLE, JOINED, TABLE_PER_CLASS };

Support for the TABLE_PER_CLASS mapping strategy is optional in this release.

If no inheritance type is specified..."


> -----Original Message-----
> From: Linda DeMichiel [mailto:Linda.Demichiel_at_Sun.COM]
> Sent: Wednesday, March 29, 2006 5:20 PM
> To: persistence_at_glassfish.dev.java.net
> Cc: Mike Keith
> Subject: Re: [Fwd: [Issue 486] Problem with abstract @Entity
> and @Id in
> b41]
>
>
> I don't see how this confusion could arise from the spec.
>
> Inheritance applies as a result of the Java language "extends"
> clause. You don't have to specify @Inheritance for it to
> apply.
>
> (The @Inheritance annotation is not required to be specified
> for inheritance. See section 9.1.29, which states that if no
> annotation
> is present, the single table per class hierarchy inheritance
> strategy applies.)
>
> Linda
>
>
>
> Sanjeeb Kumar Sahoo wrote:
>
> > Hi Mike,
> >
> > Would you mind having a look at this issue? The latest
> update suggest
> > that user must specify @Inheritance in a class to indicate that that
> > class is the root of the inheritance hierarchy. Why is this
> the case?
> > Why can't root be identified by the persistence provider runtime by
> > walking up the tree?
> >
> > Thanks,
> > Sahoo
> >
> >
> --------------------------------------------------------------
> ----------
> >
> > Subject:
> > [Issue 486] Problem with abstract @Entity and @Id in b41
> > From:
> > pkrogh_at_dev.java.net
> > Date:
> > Wed, 29 Mar 2006 15:48:07 +0000
> > To:
> > issues_at_glassfish.dev.java.net
> >
> > To:
> > issues_at_glassfish.dev.java.net
> >
> >
> > https://glassfish.dev.java.net/issues/show_bug.cgi?id=486
> >
> >
> >
> > User pkrogh changed the following:
> >
> > What |Old value |New value
> >
> ==============================================================
> ==================
> > Issue type|DEFECT |ENHANCEMENT
> >
> --------------------------------------------------------------
> ------------------
> > Priority|P3 |P4
> >
> --------------------------------------------------------------
> ------------------
> >
> >
> >
> >
> > ------- Additional comments from pkrogh_at_dev.java.net Wed
> Mar 29 15:48:07 +0000 2006 -------
> > This bug seems to be about the provider determining that
> inheritance is implied
> > without specifying the @Inheritance annotation. This is
> not defined in the
> > spec, and I believe that it was not the intention of the spec. The
> > @Inheritance tag defines that Inheritance is needed.
> >
> > It seems like a nice usability feature, but it would
> potentially require the
> > provider to walk the whole hierarchy instead of just
> looking for @Inheritance.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: issues-unsubscribe_at_glassfish.dev.java.net
> > For additional commands, e-mail: issues-help_at_glassfish.dev.java.net
> >
>