I think you're looking for the org.apache.openjpa.persistence.jdbc.Index
annotation :
ex :
import org.apache.openjpa.persistence.jdbc.Index;

@Entity
public class Person {
    . . .
    @Index
    private int myint;
    . . .
}

SQL generation (DB2) :
3786  laird  TRACE  [main] openjpa.jdbc.SQL - <t 9105104, conn 16916276>
executing stmnt 17226426 CREATE TABLE Person (id INTEGER NOT NULL, firstName
VARCHAR(254), lastName VARCHAR(254), myint INTEGER, version INTEGER, PRIMARY
KEY (id))
3962  laird  TRACE  [main] openjpa.jdbc.SQL - <t 9105104, conn 16916276>
[176 ms] spent
3971  laird  TRACE  [main] openjpa.jdbc.SQL - <t 9105104, conn 23361497>
executing stmnt 17711949 CREATE INDEX I_PERSON_MYINT ON Person (myint)

-mike

On Thu, Jul 9, 2009 at 11:30 AM, Laird Nelson <[email protected]> wrote:

> Is it possible to define a non-unique index in OpenJPA?  Hibernate offers
> the @Index annotation to do this as part of its DDL generation machinery.
>
> My apologies if this was mentioned; I didn't see it in
> http://openjpa.apache.org/builds/latest/docs/manual/manual.html.
>
> Thanks,
> Laird
>

Reply via email to