openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sapatel <sapa...@NEMOURS.ORG>
Subject RE: can JPA Entity extend non JPA Entity?
Date Fri, 02 Apr 2010 15:44:15 GMT



From: ljnelson [via OpenJPA] [] 
Sent: Thursday, April 01, 2010 11:36 AM
To: Patel, Sanjay 
Subject: Re: can JPA Entity extend non JPA Entity?


On Thu, Apr 1, 2010 at 10:56 AM, sapatel [via OpenJPA] <[hidden email] <>
> 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 message @

To unsubscribe from can JPA Entity extend non JPA Entity?, click here < (link removed)
==> . 


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

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