3.8.7.9.3. Unique Constraints

The org.apache.openjpa.persistence.jdbc.Unique annotation represents a unique constraint on the columns of a field. It is more convenient than using the uniqueConstraints property of standard JPA Table and SecondaryTable annotations, because you can apply it directly to the constrained field. The Unique annotation has the following properties:

  • boolean enabled: Set this property to false to explicitly tell OpenJPA not to constrain these columns, when OpenJPA would otherwise do so.

  • String name: The name of the constraint. OpenJPA will choose a name if you do not provide one, or will create an anonymous constraint.

  • boolean deferred: Whether to create a deferred constraint if supported by the database.