Hibernate updating database structure with new indexes
It's well known fact that hibernate work with indexes in a very strange way. It generate them only if you create a database schema from the scratch. But if you try to update the database schema hibernate will ignore new indexes.
My question is, does anybody find a solution how to ask hibernate generate SQL for new indexes during schema update.
UPDATE: I'll disagree 开发者_如何学JAVAwith Stefan Steinegger. Index management with hibernate it's a pain. Nice to see that the feature was scheduled for next release (3.5.x) and will be backward compatible to 3.3.x and 3.2.x as well. Details are here.
Schema update is not intended to be used in a production environment. It should only be used for developers.
Schema export on the other hand is recommendable to be used in production. Export the schema to get the actual schema definition and use other means to update existing databases. Write your own update scripts or use a designated tool.
The issue resolved in Hibernate 3.5.0-Beta-2 release. Details are here and here.
精彩评论