users@jpa-spec.java.net

[jpa-spec users] [jsr338-experts] Re: Should IdentifiableType#getId(Class) always return non-null?

From: Linda DeMichiel <linda.demichiel_at_oracle.com>
Date: Mon, 23 Jul 2012 09:05:52 -0700

Hi Matthew,

On 7/23/2012 6:44 AM, Matthew Adams wrote:
> Hi all,
>
> Scenario: entity "app.domain.Profile" extends abstract mapped superclass "app.domain.AbstractEntity". If
> AbstractEntity defines a single string field as its @Id, should the IdentifiableType instance corresponding to
> app.domain.Profile guarantee that its getId(Class) method will never return null?
>
> In other words, is it up to the client of the JPA metamodel to go up the entity's type hierarchy until it finds the
> SingularAttribute for the id field, or should the JPA implementation do that?
>

I'm not sure I understand your question fully. However, it is the responsibility of the metamodel implementation
to return the SingularAttribute that is the value of getId (this may involve traversing the hierarchy if getId
were not defined in the IdentifiablyType itself).

-Linda


> Thanks,
> Matthew
>
> --
> mailto:matthew_at_matthewadams.me
> skype:matthewadams12
> googletalk:matthew_at_matthewadams.me <mailto:googletalk%3Amatthew_at_matthewadams.me>
> http://matthewadams.me
> http://www.linkedin.com/in/matthewadams
>