persistence@glassfish.java.net

RE: abstract entity superclasses

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Fri, 9 Mar 2007 16:06:38 -0500

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.