How to do multiple column UniqueConstraint in hbm?

前端 未结 3 661
忘掉有多难
忘掉有多难 2020-12-10 01:01

Working on some legacy hibernate code.

How do I do the following with hbm.xml(hibernate mapping file) instead of with annotations?

@Table(name=\"user         


        
3条回答
  •  既然无缘
    2020-12-10 01:42

    You can add same unique-key attribute to two different columns. This will create composite unique key.

    
    
    

    In the above example the unique key will be created from both first_name and last_name column.

提交回复
热议问题