persistence@glassfish.java.net

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

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Thu, 30 Mar 2006 09:18:28 -0800

Mike,

Are you saying that Java inheritance does not apply to Java Persistence
without an extra annotation?

thanks,
-marina

Mike Keith wrote:
> Actually that isn't true.
> We don't say that Lob must be specified but we have been
> assuming that it must also be present if a column is a lob.
> Same for Embedded. I don't think we even say anything
> about requiring Embeddable (except for the EmbeddedId case),
> but we do. Same for Inheritance.
>
> Note that I am not saying that some of things could not be
> defaulted, because most of them can and should be, just like
> Inheritance could be defaulted. I am just saying that we didn't
> specify it to be defaultable.
>
>
>>-----Original Message-----
>>From: Linda DeMichiel [mailto:Linda.Demichiel_at_Sun.COM]
>>Sent: Wednesday, March 29, 2006 8:51 PM
>>To: Mike Keith
>>Cc: persistence_at_glassfish.dev.java.net; Sanjeeb Kumar Sahoo;
>>Krogh Peter
>>W
>>Subject: Re: [Fwd: [Issue 486] Problem with abstract @Entity
>>and @Id in
>>b41]
>>
>>
>>I see. However, we state in the spec when things are required
>>to be specified.
>>We don't require that @Inheritance be specified, and otherwise
>>always treat normal Java language inheritance as being operative,
>>so I think this interpretation is counterintuitive, although I
>>can see why confusion might arise.
>>
>>Linda
>>
>>
>>Mike Keith wrote:
>>
>>>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
>>>>>
>>>>
>