3.8.7.6.1. Container Table

The org.apache.openjpa.persistence.jdbc.ContainerTable annotation describes a database table that holds collection (or map) elements. This annotation has the following properties:

  • String name

  • String catalog

  • String schema

  • XJoinColumn[] joinColumns

  • ForeignKey joinForeignKey

  • Index joinIndex

The name, catalog, schema, and joinColumns properties describe the container table and how it joins to the owning entity’s table. These properties correspond to the same-named properties on the standard JoinTable annotation, described in Join Table . If left unspecified, the name of the table defaults to the first five characters of the entity table name, plus an underscore, plus the field name. The joinForeignKey and joinIndex properties override default foreign key and index generation for the join columns. We explore foreign keys and indexes later in this chapter.

You may notice that the container table does not define how to store the collection elements. That is left to separate annotations, which are the subject of the next sections.