itVincent Blog - Java Working Fun!

posts - 117, comments - 181, trackbacks - 0, articles - 12


Posted on 2008-12-02 10:57 itVincent 阅读(783) 评论(0)  编辑  收藏


关键字: hibernate schemaupdate 索引
  1. update  
这个所谓的bug,在目前已发布的hibernate的版本中,一直都没有解决,或者说不予理睬(Gavin King个人认为这个不是bug)

这里引用hibernate 3.2.5版的jira


The setting doesn't create indexes
SchemaUpdate is activated by this configuration setting. SchemaUpdate is not really very powerful and comes without any warranties. For example, it does not create any indexes automatically. Furthermore, SchemaUpdate is only useful in development, per definition (a production schema is never updated automatically). You don't need indexes in development.

Hibernate doesn't generate the database indexes I want in the schema!

Automatic schema export (and update) by Hibernate tools is only useful in development. You never need indexes in development, they are purely for performance and scalability tuning in production systems. Production schemas are never automatically generated, at least not completely. A DBA adds indexes to the automatically generated schema during SQL tuning and testing of the application, before going into production with the (possibly automatically generated) base schema, and her handwritten optimized DDL. Also note that optimized DDL is highly vendor specific and totally dependent on the environment (SQL execution plans, tablespace configuration, caches, etc). Even if Hibernate developers would encourage you to automatically generate production-ready schemas (we don't, and we also don't like ad-hoc SQL tuning by throwing a bunch of indexes onto a schema), Hibernate could never offer such a feature.

郁闷非常的一个"BUG",只有把 update  改成create才能生成索引