-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: multiple index on the same column in hbm2ddl
PostPosted: Thu Jan 12, 2006 7:10 pm 
Beginner
Beginner

Joined: Sun May 09, 2004 7:18 pm
Posts: 35
Hibernate version:
3.1

Hi,

I tried to generate database based on the mapping files using hbm2ddl. However, I found out that index attribute for column can't take multiple values. For example: for my tCustomer table, I want to create an index on email, and a combined index on email+password. I have no way to specify it in mapping file. Also, I am using Xdoclet to generate mapping files actually.

Please let me know if I can specify multiple index on one column in my java file or mapping file.

thank you very much.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 5:10 am 
Regular
Regular

Joined: Tue Jan 03, 2006 9:52 am
Posts: 52
Location: Zurich
I tried the following with sybase, and it works :-))

Code:
  <class name="eg.Customer" table="tCustomer">
    <id name="id" column="id" type="long">
      <generator class="native"></generator>
    </id>
    <property name="email"  index="idx_group idx_email" />
    <property name="password" index="idx_group"/>
   
  </class>


which creates the following schema commands:

Code:
create table tCustomer (
    id numeric(19,0) identity not null,
    email varchar(255) null,
    password varchar(255) null,
    primary key (id)
)

create index idx_email on tCustomer (email)
create index idx_group on tCustomer (email, password)


Urs


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 13, 2006 1:37 pm 
Beginner
Beginner

Joined: Sun May 09, 2004 7:18 pm
Posts: 35
Thank you so much. It works.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.