io.zenwave360.sdk.jpa2jdl.Blog Maven / Gradle / Ivy
package io.zenwave360.sdk.jpa2jdl;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
/**
* A Blog.
*/
@Entity
@Table(name = "blog")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Blog implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
@Column(name = "id")
private Long id;
@NotNull
@Size(min = 3)
@Column(name = "name", nullable = false)
private String name;
@NotNull
@Size(min = 2)
@Column(name = "handle", nullable = false)
private String handle;
@Column(name = "login")
private String login;
// jhipster-needle-entity-add-field - JHipster will add fields here
public Long getId() {
return this.id;
}
public Blog id(Long id) {
this.setId(id);
return this;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return this.name;
}
public Blog name(String name) {
this.setName(name);
return this;
}
public void setName(String name) {
this.name = name;
}
public String getHandle() {
return this.handle;
}
public Blog handle(String handle) {
this.setHandle(handle);
return this;
}
public void setHandle(String handle) {
this.handle = handle;
}
public String getLogin() {
return this.login;
}
public Blog login(String login) {
this.setLogin(login);
return this;
}
public void setLogin(String login) {
this.login = login;
}
// jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof Blog)) {
return false;
}
return id != null && id.equals(((Blog) o).id);
}
@Override
public int hashCode() {
// see https://vladmihalcea.com/how-to-implement-equals-and-hashcode-using-the-jpa-entity-identifier/
return getClass().hashCode();
}
// prettier-ignore
@Override
public String toString() {
return "Blog{" +
"id=" + getId() +
", name='" + getName() + "'" +
", handle='" + getHandle() + "'" +
", login='" + getLogin() + "'" +
"}";
}
}