id的自动增长

    技术2022-05-20  32

    自动生成id

     

    配置xml

    a)       generator

    常用四个:native identiy sequence uuid  其中uuid的返回值为String类型

     

     

    配置annotation

    a)       自定义id

    b)      Auto

    c)      IDENTITY

    d)      SEQUENCE

    e)       TABLE

    id前加上@GeneratedValue()

     

     

    在联合主键时,

    Xml: composite-id

     要实现serializable接口,并且要重写equalhashCode方法

    Annotation

         Embeddable @id

         EmbeddID(*)

         @id @idClass(*)


    最新回复(0)