package org.jhipster.domain;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.util.Objects;
/**
* A Blog.
*/
@Entity
@Table(name = "blog")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Blog implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
@SequenceGenerator(name = "sequenceGenerator")
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;
@ManyToOne
private User user;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public Blog name(String name) {
this.name = name;
return this;
}
public void setName(String name) {
this.name = name;
}
public String getHandle() {
return handle;
}
public Blog handle(String handle) {
this.handle = handle;
return this;
}
public void setHandle(String handle) {
this.handle = handle;
}
public User getUser() {
return user;
}
public Blog user(User user) {
this.user = user;
return this;
}
public void setUser(User user) {
this.user = user;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Blog blog = (Blog) o;
if (blog.id == null || id == null) {
return false;
}
return Objects.equals(id, blog.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
@Override
public String toString() {
return "Blog{" +
"id=" + id +
", name='" + name + "'" +
", handle='" + handle + "'" +
'}';
}
}