| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!--NewPage--> |
| <HTML> |
| <HEAD> |
| <!-- Generated by javadoc (build 1.6.0) on Fri Sep 25 03:18:13 EDT 2009 --> |
| <TITLE> |
| MappedSuperclass (EclipseLink 1.1.3, build 'v20090925-r5281' API Reference) |
| </TITLE> |
| |
| <META NAME="date" CONTENT="2009-09-25"> |
| |
| <LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"> |
| |
| <SCRIPT type="text/javascript"> |
| function windowTitle() |
| { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="MappedSuperclass (EclipseLink 1.1.3, build 'v20090925-r5281' API Reference)"; |
| } |
| } |
| </SCRIPT> |
| <NOSCRIPT> |
| </NOSCRIPT> |
| |
| </HEAD> |
| |
| <BODY BGCOLOR="white" onload="windowTitle();"> |
| <HR> |
| |
| |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <A NAME="navbar_top"><!-- --></A> |
| <A HREF="#skip-navbar_top" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_top_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../serialized-form.html"><FONT CLASS="NavBarFont1"><B>Serialized</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| EclipseLink 1.1.3, build 'v20090925-r5281' API Reference</EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../javax/persistence/MapKey.html" title="annotation in javax.persistence"><B>PREV CLASS</B></A> |
| <A HREF="../../javax/persistence/NamedNativeQueries.html" title="annotation in javax.persistence"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../index.html?javax/persistence/MappedSuperclass.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="MappedSuperclass.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: REQUIRED | OPTIONAL</FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: ELEMENT</FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_top"></A> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| |
| <HR> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <H2> |
| <FONT SIZE="-1"> |
| javax.persistence</FONT> |
| <BR> |
| Annotation Type MappedSuperclass</H2> |
| <HR> |
| <DL> |
| <DT><PRE><FONT SIZE="-1">@Target(value=TYPE) |
| @Retention(value=RUNTIME) |
| </FONT>public @interface <B>MappedSuperclass</B></DL> |
| </PRE> |
| |
| <P> |
| Designates a class whose mapping information is applied |
| to the entities that inherit from it. A mapped superclass |
| has no separate table defined for it. |
| |
| <p> A class designated with the <code>MappedSuperclass</code> |
| annotation can be mapped in the same way as an entity except that the |
| mappings will apply only to its subclasses since no table |
| exists for the mapped superclass itself. When applied to the |
| subclasses the inherited mappings will apply in the context |
| of the subclass tables. Mapping information may be overridden |
| in such subclasses by using the <A HREF="../../javax/persistence/AttributeOverride.html" title="annotation in javax.persistence"><CODE>AttributeOverride</CODE></A> and |
| <A HREF="../../javax/persistence/AssociationOverride.html" title="annotation in javax.persistence"><CODE>AssociationOverride</CODE></A> annotations or corresponding XML elements. |
| |
| <pre> |
| Example: Concrete class as a mapped superclass |
| |
| @MappedSuperclass |
| public class Employee { |
| |
| @Id protected Integer empId; |
| @Version protected Integer version; |
| @ManyToOne @JoinColumn(name="ADDR") |
| protected Address address; |
| |
| public Integer getEmpId() { ... } |
| public void setEmpId(Integer id) { ... } |
| public Address getAddress() { ... } |
| public void setAddress(Address addr) { ... } |
| } |
| |
| // Default table is FTEMPLOYEE table |
| @Entity |
| public class FTEmployee extends Employee { |
| |
| // Inherited empId field mapped to FTEMPLOYEE.EMPID |
| // Inherited version field mapped to FTEMPLOYEE.VERSION |
| // Inherited address field mapped to FTEMPLOYEE.ADDR fk |
| |
| |
| // Defaults to FTEMPLOYEE.SALARY |
| |
| protected Integer salary; |
| |
| |
| public FTEmployee() {} |
| |
| |
| public Integer getSalary() { ... } |
| |
| public void setSalary(Integer salary) { ... } |
| } |
| |
| @Entity @Table(name="PT_EMP") |
| @AssociationOverride(name="address", |
| |
| |
| joincolumns=@JoinColumn(name="ADDR_ID")) |
| public class PartTimeEmployee extends Employee { |
| |
| // Inherited empId field mapped to PT_EMP.EMPID |
| // Inherited version field mapped to PT_EMP.VERSION |
| // address field mapping overridden to PT_EMP.ADDR_ID fk |
| @Column(name="WAGE") |
| protected Float hourlyWage; |
| |
| public PartTimeEmployee() {} |
| |
| public Float getHourlyWage() { ... } |
| public void setHourlyWage(Float wage) { ... } |
| } |
| |
| Example: Non-entity superclass |
| |
| public class Cart { |
| |
| // This state is transient |
| Integer operationCount; |
| |
| public Cart() { operationCount = 0; } |
| public Integer getOperationCount() { return operationCount; } |
| public void incrementOperationCount() { operationCount++; } |
| } |
| |
| @Entity |
| public class ShoppingCart extends Cart { |
| |
| Collection<Item> items = new Vector<Item>(); |
| |
| public ShoppingCart() { super(); } |
| |
| |
| ... |
| |
| @OneToMany |
| public Collection<Item> getItems() { return items; } |
| public void addItem(Item item) { |
| items.add(item); |
| incrementOperationCount(); |
| } |
| } |
| </pre> |
| <P> |
| |
| <P> |
| <DL> |
| <DT><B>Since:</B></DT> |
| <DD>Java Persistence 1.0</DD> |
| </DL> |
| |
| <P> |
| |
| <P> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <HR> |
| |
| |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <A NAME="navbar_bottom"><!-- --></A> |
| <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> |
| <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> |
| <TR> |
| <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> |
| <A NAME="navbar_bottom_firstrow"><!-- --></A> |
| <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> |
| <TR ALIGN="center" VALIGN="top"> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> |
| <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../serialized-form.html"><FONT CLASS="NavBarFont1"><B>Serialized</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> |
| <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> |
| </TR> |
| </TABLE> |
| </TD> |
| <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> |
| EclipseLink 1.1.3, build 'v20090925-r5281' API Reference</EM> |
| </TD> |
| </TR> |
| |
| <TR> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../javax/persistence/MapKey.html" title="annotation in javax.persistence"><B>PREV CLASS</B></A> |
| <A HREF="../../javax/persistence/NamedNativeQueries.html" title="annotation in javax.persistence"><B>NEXT CLASS</B></A></FONT></TD> |
| <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> |
| <A HREF="../../index.html?javax/persistence/MappedSuperclass.html" target="_top"><B>FRAMES</B></A> |
| <A HREF="MappedSuperclass.html" target="_top"><B>NO FRAMES</B></A> |
| <SCRIPT type="text/javascript"> |
| <!-- |
| if(window==top) { |
| document.writeln('<A HREF="../../allclasses-noframe.html"><B>All Classes</B></A>'); |
| } |
| //--> |
| </SCRIPT> |
| <NOSCRIPT> |
| <A HREF="../../allclasses-noframe.html"><B>All Classes</B></A> |
| </NOSCRIPT> |
| |
| |
| </FONT></TD> |
| </TR> |
| <TR> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| SUMMARY: REQUIRED | OPTIONAL</FONT></TD> |
| <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> |
| DETAIL: ELEMENT</FONT></TD> |
| </TR> |
| </TABLE> |
| <A NAME="skip-navbar_bottom"></A> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| |
| <HR> |
| |
| </BODY> |
| </HTML> |