persistence@glassfish.java.net

Re: abstract entity superclasses

From: jeff <jeffrey.blattman_at_yahoo.com>
Date: Fri, 9 Mar 2007 15:09:05 -0800 (PST)

marina,

that was it. i left an entry out of my PU. sorry for the confusion.

Marina Vatkina <Marina.Vatkina_at_Sun.COM> wrote: Jeff,

This exception usually happens if the processing code can't find the concrete
class. Is it a Java EE or a Java SE app? If the latter, did you list all the
classes in the persistence.xml? If the former, are both classes packaged into
the same jar?

thanks,
-marina

jeff wrote:
> marina,
>
> all are marked as entities, abstract and concrete classes.
>
> thanks.
>
> */Marina Vatkina /* wrote:
>
> 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 /* 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
> >
> > at Yahoo! Autos.
> >
> >
> >
> >
> >
> ------------------------------------------------------------------------
> > TV dinner still cooling?
> > Check out "Tonight's Picks"
> > on Yahoo! TV.
>
>
> ------------------------------------------------------------------------
> Don't pick lemons.
> See all the new 2007 cars
>
> at Yahoo! Autos.
>
>


 
---------------------------------
The fish are biting.
 Get more visitors on your site using Yahoo! Search Marketing.