Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ayakimchuk322/f53db74b671d02dc724cef9be561893b to your computer and use it in GitHub Desktop.
Save ayakimchuk322/f53db74b671d02dc724cef9be561893b to your computer and use it in GitHub Desktop.
IntelliJ IDEA JPA Entity File Template
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
#parse("File Header.java")
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Objects;
@Entity
@Table(name = "${TABLE_NAME}")
@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Builder
public class ${NAME} {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
${NAME} that = (${NAME}) o;
return Objects.equals(id, that.id);
}
@Override
public int hashCode() {
return Objects.hash(id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment