Jeff,
You need to mark Bar as an entity as well.
thanks,
-marina
jeff wrote:
> see exception below. i tried following the example from 35 in the spec.
> i have the @InheritanceStrategy annotation in the abstract class, and
> the @DiscriminatorValue annotation in all subclasses.
>
> it's a little unclear to me which of the annotations are required, and
> which i can leave off an have it pick some reasonable defaults. the spec
> is a little lean in this section.
>
> thanks!
>
> javax.persistence.EntityExistsException:
> Exception Description: This class does not define a public default
> constructor, or the constructor raised an exception.
> Internal Exception: java.lang.InstantiationException
> Descriptor: RelationalDescriptor(com.sun.portal.pom.PortletEntity -->
> [DatabaseTable(PORTLETENTITY)])
>
> */Gordon Yorke <gordon.yorke_at_oracle.com>/* wrote:
>
> You should be able to mark the abstract Foo class as being an
> Entity. Can you provide the exception that you are getting?
> --Gordon
>
> -----Original Message-----
> *From:* jeff [mailto:farble1670_at_yahoo.com]
> *Sent:* Friday, March 09, 2007 3:55 PM
> *To:* persistence_at_glassfish.dev.java.net
> *Subject:* abstract entity superclasses
>
> i have class Bar extends Foo. i want Foo to contain persistent
> fields inherited by Bar, but i also want Foo to be abstract.
>
> is this possible? if i leave the @Entity annotation, then i get
> an error telling me that the class cannot be instantiated
> (right, it's abstract). this sort of puzzles me though because i
> never try to create any instances of it.
>
> if i remove the entity annotation, i get an error at runtime
> from Bar saying it can't find the ID ... the ID field is defined
> in the abstract base class Foo.
>
> any ideas?
> thanks.
> ------------------------------------------------------------------------
> Don't pick lemons.
> See all the new 2007 cars
> <http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE0OGRsc3F2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3Y2Fycw-->
> at Yahoo! Autos.
> <http://autos.yahoo.com/new_cars.html;_ylc=X3oDMTE0OGRsc3F2BF9TAzk3MTA3MDc2BHNlYwNtYWlsdGFncwRzbGsDbmV3Y2Fycw-->
>
>
>
> ------------------------------------------------------------------------
> TV dinner still cooling?
> Check out "Tonight's Picks"
> <http://us.rd.yahoo.com/evt=49979/*http://tv.yahoo.com/> on Yahoo! TV.