Hi!

I am having a problem with the SchemaExport tool: it's not generating 
indexes in MS SQL Server 2008.

My NHibernate mappings include a <database-object> element to define 
indexes. The problem is that this SQL doesn't get included in the schema 
when I callSchemaExport.Create (exported file does not contain then). 
Everything else gets created, but there are no indexes.

One of the entities looks like this, for example:

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">

  <class xmlns="urn:nhibernate-mapping-2.2" 
      name="MyApp.Entities.SomeEntity, MyApp.Entities" table="SomeEntity">

    <!- -->

  </class>

  <database-object>
    <create>
      CREATE INDEX [Idx_SomeEntityIndex] ON [SomeEntity] 
          ([Field1] ASC, [Field2] ASC) INCLUDE ( [Field3], [Field4], [Field5])
      CREATE STATISTICS [Stat_SomeEntityStat] ON [SomeEntity] 
          ([Field1], [Field2])
    </create>
    <drop>
      DROP INDEX [Idx_SomeEntityIndex] ON [SomeEntity]
      DROP STATISTICS [Stat_SomeEntityStat]
    </drop>
    <dialect-scope name="NHibernate.Dialect.MsSql2008Dialect, NHibernate"/>
  </database-object>
</hibernate-mapping>

Strange thing is that this used to work before (probably before moving from 
NH2 to NH3), and I am not sure if something changed in NHibernate which 
prevents this from executing.

Dialect matches my dialect in the config file.

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/nhusers/-/q5OVocJ7eRwJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to