jpa常用dao層註解
阿新 • • 發佈:2018-12-13
@Column(unique = true) 保證存入資料庫唯一
@Entity @Table(name = "TBL_RTNURLCFG") @Getter @Setter public class RtnUrlDO extends BaseDO { private static final long serialVersionUID = -8071336977569177660L; /** * 站點名稱。用於定義待增加站點的站點名稱。 */ @Size(max = 64) @Column(unique = true) private String siteName; }
@Getter @Setter @MappedSuperclass @EntityListeners(AuditingEntityListener.class) public class BaseDO { @Id @GenericGenerator(name = "idGenerator", strategy = "uuid.hex") @GeneratedValue(generator = "idGenerator") protected String id; @CreatedDate protected Long createTime; @LastModifiedDate protected Long updateTime; }