generated key...

 

1. javax.persistence.GeneratedValue

@Data

@MappedSuperclass

public abstract class UUIDEntity {

 

@Id

    @GeneratedValue(generator = "systemUUID")

    @Column(name = "id", length = Constants.UUID_LENGTH)

    private String id;

}

2. hibernate generatedValue

 

@ToString(callSuper = true)

@EqualsAndHashCode(callSuper = true)

@Entity @Data @Table(name = "T_TEST")

@GenericGenerator(name="systemUUID",strategy="uuid2")

public class TestEntity extends UUIDEntity {

posted @ 2015-04-24 13:07  samu  阅读(304)  评论(0编辑  收藏  举报