A normal index like the one below won't get created automatically if hibernate.hbm2ddl.auto is set to [b]update[/b].
If the property is a primary key or it's unique, the index will be created, however. It's a hibernate bug reported here: [url]http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012[/url].
A simple solution will be creating the index locally and migrating the creation script to the live system. If you opt for hibernate.hbm2ddl.auto = [b]create[/b], all data need to be backed up as this option clears the database before reconstructing the whole schema.
<property
name="idA"
index="idx_id_a"
not-null="true"
type="long"
column="..."/>
If the property is a primary key or it's unique, the index will be created, however. It's a hibernate bug reported here: [url]http://opensource.atlassian.com/projects/hibernate/browse/HHH-1012[/url].
A simple solution will be creating the index locally and migrating the creation script to the live system. If you opt for hibernate.hbm2ddl.auto = [b]create[/b], all data need to be backed up as this option clears the database before reconstructing the whole schema.
当使用Hibernate并设置hibernate.hbm2ddl.auto为'update'时,普通的索引如idx_id_a不会被自动创建。若索引关联的是主键或唯一键,则会自动创建。此行为被视为Hibernate的一个已知问题。
726

被折叠的 条评论
为什么被折叠?



