jpa常用dao层注解

@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;
}

猜你喜欢

转载自blog.csdn.net/nmjhehe/article/details/84833359