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

Thanks. 

 

From: ljnelson [via OpenJPA] [mailto:ml-node+4837820-1225260212-48703@n2.nabble.com] 
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] <http://n2.nabble.com/user/SendEmail.jtp?type=node&node=4837820&i=0>
> 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.
}

@Entity
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.) 


Best,
Laird



________________________________

View message @ http://n2.nabble.com/can-JPA-Entity-extend-non-JPA-Entity-tp4837568p4837820.html

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

 


-- 
View this message in context: http://n2.nabble.com/can-JPA-Entity-extend-non-JPA-Entity-tp4837568p4843229.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

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