Using Hibernate UUIDGenerator via annotations

后端 未结 8 667
无人共我
无人共我 2020-12-04 10:31

I\'m using my uuid as following:

@Id
@GeneratedValue(generator = \"uuid\")
@GenericGenerator(name = \"uuid\", strategy = \"uuid\")
@Column(name = \"uuid\", u         


        
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 11:20

    @Id
    @GeneratedValue(generator = "uuid")
    @GenericGenerator(name = "uuid", strategy = "uuid")
    @Column(name = "UUID_ID")
    public String getId(){
    return id;
    }
    

    This is the proper way to use annotation for uuid generators in Hibernate 5.0.11.FINAL.

    Note: IT is deprecated.

提交回复
热议问题