openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ljnelson <>
Subject Re: can JPA Entity extend non JPA Entity?
Date Thu, 01 Apr 2010 15:36:00 GMT

On Thu, Apr 1, 2010 at 10:56 AM, sapatel [via OpenJPA] <<>
> wrote:

> What I want to do is I want all my JPA entities to extend some BaseEntity
> class where can I define some properites (which are not table columns) to
> use/share.

Just do it:

public class A {
  // no matter what you put in here it won't be mapped to the database,
  // even if you use JPA annotations.

public class B extends A {
  // All state and behavior is available from A.  Only fields defined in B
that are
  // annotated with JPA annotations will get mapped to the database.

(If you want some of A's state to be mapped, then you want to look at the
@MappedSuperclass annotation, but that is not what you are claiming you want
from your question.)


View this message in context:
Sent from the OpenJPA Users mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message