-->
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.  [ 2 posts ] 
Author Message
 Post subject: Is there a way to describe table indexes in mapping files?
PostPosted: Tue Aug 23, 2005 12:39 am 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
I believe this is possible with Hibernate. I don't know if it's in NHibernate (yet).

Since I'm using NHibernate to produce my database schema, I'd like it to create all the indexes from just the mapping files as well. One of my tables, for example, will usually be searched by a string column rather than its id (int) column. Can I get NHibernate to create an index on that column? I use unique="true" to create unique constraints with indexes, but how can I get a non-unique index created?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 9:24 am 
Regular
Regular

Joined: Fri May 13, 2005 4:08 pm
Posts: 64
I found my own answer in the Hibernate documentation:

For example, the following property mapping will create an index in the database on that column.

Code:
<property name="Email" access="field.camelcase">
   <column name="Email" index="email_idx"/>
</property>


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.