Hi,
I use Hibernate annotation to define a POJO which I would like to create index on a column. Following is my POJO:
@Entity
@Table(name = "ROUTER")
@org.hibernate.annotations.Table(appliesTo="ROUTER", indexes = { @Index(name="router_mac_index", columnNames = { "MAC" } ) } )
public class Router {
@Column(name="MAC", length=18)
public String getMac() {
return mac;
}
}
After the table is created in postgres I noticed that the 'MAC' column of the table is defined as 'UNIQUE' but there is no index being created. Am I using the index annotation correctly?
Here is the DDL
CREATE TABLE router
(
id integer NOT NULL,
state integer,
protocol character varying(16),
mac character varying(18),
firmware_ver character varying(32) NOT NULL,
max_bandwidth integer NOT NULL DEFAULT 0,
model character varying(64),
oplock integer,
CONSTRAINT router_pkey PRIMARY KEY (id),
CONSTRAINT router_mac_key UNIQUE (mac)
)
|