tags:

views:

33

answers:

2

If I let nhibernate generate the schema, what about other indexes I may put on the tables for performance reasons?

e.g. say I need to order by a datetime field allot, I may put a index on that column.

+1  A: 

What about them? You can put them if you want. NH will not do performance tuning for you.

epitka
+1  A: 

You can create a single-column unique index by specifying unique="true" in a class property's mapping.

You can create a multi-column unique index by giving each participating property the same unique-key="foo" value.

You can create a multi-column, non-unique index the same way, except the attribute to use is index="bar" instead of unique-key="foo".

Finally, for more complex cases, you can create the index inside a <database-object> element in the mapping file.

Paul Lalonde