openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Dick <michael.d.d...@gmail.com>
Subject Re: Define index?
Date Thu, 09 Jul 2009 18:32:27 GMT
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 <ljnelson@gmail.com> 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
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message