Creating Indexes on DB with Hibernate @Index Annotation

后端 未结 4 1989
无人共我
无人共我 2020-12-30 01:48

I have annotation-driven hibernate capabilies on my project.

Now I want to create an index over a column. My current column definition is

@NotNull
@C         


        
4条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-30 02:14

    Interestingly, in my Hibernate configuration I was using hibernate.hbm2ddl.auto=update.

    This one modifies an existing database. I was manually DROPping the table tableName and restarting Tomcat and the table had been constructed but index was not being created.

    However, I made hibernate.hbm2ddl.auto=create which re-creates database upon each instantiation of webapp, it dropped all my database and rebuilt back and -hell yeah- my new index has been created!

提交回复
热议问题