3.8.7.9. Indexes and Constraints
OpenJPA uses index information during schema generation to index the proper columns. OpenJPA uses foreign key and unique constraint information during schema creation to generate the proper database constraints, and also at runtime to order SQL statements to avoid constraint violations while maximizing SQL batch size.
OpenJPA assumes certain columns have indexes or constraints based on your mapping defaults, as detailed in Mapping Defaults. You can override the configured defaults on individual joins, field values, collection elements, map keys, or map values using the annotations presented in the following sections.