| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <title>CollectionTable</title> |
| <link rel="stylesheet" type="text/css" href="../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="CollectionTable"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../javax/persistence/CascadeType.html" title="enum in javax.persistence"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/persistence/Column.html" title="annotation in javax.persistence"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/persistence/CollectionTable.html" target="_top">Frames</a></li> |
| <li><a href="CollectionTable.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Field | </li> |
| <li>Required | </li> |
| <li><a href="#annotation.type.optional.element.summary">Optional</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#annotation.type.element.detail">Element</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">javax.persistence</div> |
| <h2 title="Annotation Type CollectionTable" class="title">Annotation Type CollectionTable</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <hr> |
| <br> |
| <pre>@Target(value={METHOD,FIELD}) |
| @Retention(value=RUNTIME) |
| public @interface <span class="memberNameLabel">CollectionTable</span></pre> |
| <div class="block">Specifies the table that is used for the mapping of |
| collections of basic or embeddable types. Applied |
| to the collection-valued field or property. |
| |
| <p>By default, the columns of the collection table that correspond |
| to the embeddable class or basic type are derived from the |
| attributes of the embeddable class or from the basic type according |
| to the default values of the <code>Column</code> annotation. In the case |
| of a basic type, the column name is derived from the name of the |
| collection-valued field or property. In the case of an embeddable |
| class, the column names are derived from the field or property |
| names of the embeddable class. |
| <ul> |
| <li> To override the default properties of the column used for a |
| basic type, the <code>Column</code> annotation is used on the |
| collection-valued attribute in addition to the |
| <code>ElementCollection</code> annotation. |
| |
| <li> To override these defaults for an embeddable class, the |
| <code>AttributeOverride</code> and/or |
| <code>AttributeOverrides</code> annotations can be used in |
| addition to the <code>ElementCollection</code> annotation. If the |
| embeddable class contains references to other entities, the default |
| values for the columns corresponding to those references may be |
| overridden by means of the <code>AssociationOverride</code> and/or |
| <code>AssociationOverrides</code> annotations. |
| </ul> |
| |
| <p> If the <code>CollectionTable</code> annotation is missing, the |
| default values of the <code>CollectionTable</code> annotation |
| elements apply. |
| |
| <pre> |
| Example: |
| |
| @Embeddable public class Address { |
| protected String street; |
| protected String city; |
| protected String state; |
| ... |
| } |
| |
| @Entity public class Person { |
| @Id protected String ssn; |
| protected String name; |
| protected Address home; |
| ... |
| @ElementCollection // use default table (PERSON_NICKNAMES) |
| @Column(name="name", length=50) |
| protected Set<String> nickNames = new HashSet(); |
| ... |
| } |
| |
| @Entity public class WealthyPerson extends Person { |
| @ElementCollection |
| @CollectionTable(name="HOMES") // use default join column name |
| @AttributeOverrides({ |
| @AttributeOverride(name="street", |
| column=@Column(name="HOME_STREET")), |
| @AttributeOverride(name="city", |
| column=@Column(name="HOME_CITY")), |
| @AttributeOverride(name="state", |
| column=@Column(name="HOME_STATE")) |
| }) |
| protected Set<Address> vacationHomes = new HashSet(); |
| ... |
| } |
| </pre></div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Java Persistence 2.0</dd> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../javax/persistence/ElementCollection.html" title="annotation in javax.persistence"><code>ElementCollection</code></a>, |
| <a href="../../javax/persistence/AttributeOverride.html" title="annotation in javax.persistence"><code>AttributeOverride</code></a>, |
| <a href="../../javax/persistence/AssociationOverride.html" title="annotation in javax.persistence"><code>AssociationOverride</code></a>, |
| <a href="../../javax/persistence/Column.html" title="annotation in javax.persistence"><code>Column</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation.type.optional.element.summary"> |
| <!-- --> |
| </a> |
| <h3>Optional Element Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation"> |
| <caption><span>Optional Elements</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Optional Element and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#catalog--">catalog</a></span></code> |
| <div class="block">(Optional) The catalog of the table.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/persistence/ForeignKey.html" title="annotation in javax.persistence">ForeignKey</a></code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#foreignKey--">foreignKey</a></span></code> |
| <div class="block">(Optional) Used to specify or control the generation of a |
| foreign key constraint for the columns corresponding to the |
| <code>joinColumns</code> element when table generation is in |
| effect.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/persistence/Index.html" title="annotation in javax.persistence">Index</a>[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#indexes--">indexes</a></span></code> |
| <div class="block">(Optional) Indexes for the table.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code><a href="../../javax/persistence/JoinColumn.html" title="annotation in javax.persistence">JoinColumn</a>[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#joinColumns--">joinColumns</a></span></code> |
| <div class="block">(Optional) The foreign key columns of the collection table |
| which reference the primary table of the entity.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#name--">name</a></span></code> |
| <div class="block">(Optional) The name of the collection table.</div> |
| </td> |
| </tr> |
| <tr class="rowColor"> |
| <td class="colFirst"><code>java.lang.String</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#schema--">schema</a></span></code> |
| <div class="block">(Optional) The schema of the table.</div> |
| </td> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../javax/persistence/UniqueConstraint.html" title="annotation in javax.persistence">UniqueConstraint</a>[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../javax/persistence/CollectionTable.html#uniqueConstraints--">uniqueConstraints</a></span></code> |
| <div class="block">(Optional) Unique constraints that are to be placed on the |
| table.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="annotation.type.element.detail"> |
| <!-- --> |
| </a> |
| <h3>Element Detail</h3> |
| <a name="name--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>name</h4> |
| <pre>public abstract java.lang.String name</pre> |
| <div class="block">(Optional) The name of the collection table. If not specified, |
| it defaults to the concatenation of the name of the containing |
| entity and the name of the collection attribute, separated by |
| an underscore.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>""</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="catalog--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>catalog</h4> |
| <pre>public abstract java.lang.String catalog</pre> |
| <div class="block">(Optional) The catalog of the table. If not specified, the |
| default catalog is used.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>""</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="schema--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>schema</h4> |
| <pre>public abstract java.lang.String schema</pre> |
| <div class="block">(Optional) The schema of the table. If not specified, the |
| default schema for the user is used.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>""</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="joinColumns--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>joinColumns</h4> |
| <pre>public abstract <a href="../../javax/persistence/JoinColumn.html" title="annotation in javax.persistence">JoinColumn</a>[] joinColumns</pre> |
| <div class="block">(Optional) The foreign key columns of the collection table |
| which reference the primary table of the entity. The default |
| only applies if a single join column is used. The default is |
| the same as for <code>JoinColumn</code> (i.e., the |
| concatenation of the following: the name of the entity; "_"; |
| the name of the referenced primary key column.) However, if |
| there is more than one join column, a <code>JoinColumn</code> |
| annotation must be specified for each join column using the |
| <code>JoinColumns</code> annotation. In this case, both the |
| <code>name</code> and the <code>referencedColumnName</code> |
| elements must be specified in each such |
| <code>JoinColumn</code> annotation.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>{}</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="foreignKey--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>foreignKey</h4> |
| <pre>public abstract <a href="../../javax/persistence/ForeignKey.html" title="annotation in javax.persistence">ForeignKey</a> foreignKey</pre> |
| <div class="block">(Optional) Used to specify or control the generation of a |
| foreign key constraint for the columns corresponding to the |
| <code>joinColumns</code> element when table generation is in |
| effect. If both this element and the <code>foreignKey</code> |
| element of any of the <code>joinColumns</code> elements are |
| specified, the behavior is undefined. If no foreign key |
| annotation element is specified in either location, the |
| persistence provider's default foreign key strategy will |
| apply.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Java Persistence 2.1</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>@javax.persistence.ForeignKey(javax.persistence.ConstraintMode.PROVIDER_DEFAULT)</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="uniqueConstraints--"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>uniqueConstraints</h4> |
| <pre>public abstract <a href="../../javax/persistence/UniqueConstraint.html" title="annotation in javax.persistence">UniqueConstraint</a>[] uniqueConstraints</pre> |
| <div class="block">(Optional) Unique constraints that are to be placed on the |
| table. These are only used if table generation is in effect.</div> |
| <dl> |
| <dt>Default:</dt> |
| <dd>{}</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="indexes--"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>indexes</h4> |
| <pre>public abstract <a href="../../javax/persistence/Index.html" title="annotation in javax.persistence">Index</a>[] indexes</pre> |
| <div class="block">(Optional) Indexes for the table. These are only used if |
| table generation is in effect.</div> |
| <dl> |
| <dt><span class="simpleTagLabel">Since:</span></dt> |
| <dd>Java Persistence 2.1</dd> |
| </dl> |
| <dl> |
| <dt>Default:</dt> |
| <dd>{}</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../index-all.html">Index</a></li> |
| <li><a href="../../help-doc.html">Help</a></li> |
| </ul> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../javax/persistence/CascadeType.html" title="enum in javax.persistence"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../javax/persistence/Column.html" title="annotation in javax.persistence"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../index.html?javax/persistence/CollectionTable.html" target="_top">Frames</a></li> |
| <li><a href="CollectionTable.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../allclasses-noframe.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Field | </li> |
| <li>Required | </li> |
| <li><a href="#annotation.type.optional.element.summary">Optional</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li><a href="#annotation.type.element.detail">Element</a></li> |
| </ul> |
| </div> |
| <a name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </body> |
| </html> |