Jump to: navigation, search


< EclipseLink‎ | Examples‎ | JPA
Revision as of 11:24, 24 January 2011 by James.sutherland.oracle.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

EclipseLink (as of 2.2) provides a way to have a database INDEX generated when EclipseLink is used to generate the database. An index is used in a database to optimize queries that use that column to provide optimal look-up and avoid table scans. Different databases have different levels of index support, EclipseLink supports the creation of basic indexes on databases that support them. EclipseLink supports index creation using its @Index annotation or <index> xml element. The @Index has a name and a set of columns.

Example Index

The firstName and lastName are indexed.

@Index(name="EMP_NAME_INDEX", columns={@Column(name="F_NAME"),@Column(name="L_NAME")})
public class Employee{
    private long id;
    private String firstName;
    private String lastName;

This produces the SQL,