All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.shaneking.sql.entity.SKIdAdtVerEntity Maven / Gradle / Ivy

There is a newer version: 0.15.1
Show newest version
package org.shaneking.sql.entity;

import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import org.shaneking.skava.lang.Integer0;

import javax.persistence.Column;
import javax.persistence.Transient;
import javax.persistence.Version;

@Accessors(chain = true)
@ToString
public abstract class SKIdAdtVerEntity extends SKIdAdtEntity {
  @Transient
  public static final String FIELD__VER = "ver";

  @Column(nullable = false, columnDefinition = "COMMENT 'Version for optimistic locking'")
  @Getter
  @Setter
  @Version
  private Integer ver;

  public SKIdAdtVerEntity initVer() {
    return this.setVer(Integer0.null2Zero(this.getVer()));
  }

  @Override
  public SKIdAdtVerEntity initWithUserId(@NonNull String userId) {
    super.initWithUserId(userId);
    return this.initVer();
  }

  @Override
  public SKIdAdtVerEntity initWithUserIdAndId(@NonNull String userId, @NonNull String id) {
    this.initId(id);
    return this.initWithUserId(userId);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy