How to use Hibernate Annotations to add an index on a Lob / Clob / tinyblob

后端 未结 3 1608
天命终不由人
天命终不由人 2021-01-06 04:33

I have a bean which I map to the database using Hibernate. I\'m using Hibernate Annotations to indicate the mapping I want, and to create the indices. The thoroughly simplif

3条回答
  •  醉酒成梦
    2021-01-06 05:10

    You could do this using Hibernate's auxiliary objects support, but it cannot be done using annotations :-(.

    In your example, it would look something like this (lots of stuff omitted for brevity):

    
      
      
        create index sysuuid on persons ( system, `uuid`(8) )
        drop index sysuuid
        
      
    
    

    I apologize for the lack of an annotation-based answer :-(. Hopefully this helps.

    NOTE: If you do take this approach, be aware that the dialect scope has to match exactly. For example, if your Hibernate configuration says to use MySQL5InnoDBDialect, then you must have this dialect in the element as well. Using MySQLDialect will not work even though it is the super-class of the InnoDB dialect.

提交回复
热议问题