Is it possible to set index of multiple columns while the one of columns is the Primary Key
Asked
Active
Viewed 4,086 times
2 Answers
0
See this post (googled java hibernate jpa index):
Specifying an Index (Non-Unique Key) Using JPA
http://www.objectdb.com/java/jpa/entity/index
Then see that (googled java hibernate jpa index composite):

Community
- 1
- 1

surfealokesea
- 4,971
- 4
- 28
- 38
-
I know that primary key is already index. my question is if I can put a new index which include two or more columns while one of them is the primary key ? – john Smith Jul 09 '13 at 13:31
-
2@johnSmith: I'm not sure whether you read them through. Last link shows how to define multiple column indexes. It doesn't care whether one of them is primary key or not. You can use it. – GokcenG Jul 09 '13 at 14:56
0
You can do it like this:
<id name="id" type="NumericInteger">
<column name="ID" index="INDEX01"/>
</id>
The key is to remove column="ID" as property of Node <id> and place it as <column> definition instead

Piotrjavspl
- 51
- 3