git-extractor/src/main/java/ru/ulstu/extractor/model/Commit.java

77 lines
1.7 KiB
Java

package ru.ulstu.extractor.model;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Entity
public class Commit extends BaseEntity {
private String hash;
private Date date;
private String message;
@ManyToOne
private Author author;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "commit_id", unique = true)
@Fetch(FetchMode.SUBSELECT)
private List<FileChange> fileChanges = new ArrayList<>();
public Commit() {
}
public Commit(String message, Author author, Date date) {
this.message = message;
this.author = author;
this.date = date;
}
public String getMessage() {
return message;
}
public Date getDate() {
return date;
}
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
public void setDate(Date date) {
this.date = date;
}
public void setMessage(String message) {
this.message = message;
}
public void setAuthor(Author author) {
this.author = author;
}
public List<FileChange> getFileChanges() {
return fileChanges;
}
public void setFileChanges(List<FileChange> fileChanges) {
this.fileChanges = fileChanges;
}
public Author getAuthor() {
return author;
}
}