Commit 6f518292 authored by michael.simon's avatar michael.simon
Browse files

add created at column

parent 91e58277
......@@ -11,11 +11,14 @@
package edu.kit.scc.webreg.entity;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@Entity(name = "UserGroupEntity")
......@@ -34,6 +37,9 @@ public class UserGroupEntity implements Serializable {
@JoinColumn(name = "group_id", nullable = false)
private GroupEntity group;
@Column(name = "created_at")
protected Date createdAt;
public UserEntity getUser() {
return user;
}
......@@ -50,6 +56,12 @@ public class UserGroupEntity implements Serializable {
this.group = group;
}
@PrePersist
public void prePersist() {
Date d = new Date();
setCreatedAt(d);
}
@Override
public int hashCode() {
final int prime = 31;
......@@ -79,5 +91,13 @@ public class UserGroupEntity implements Serializable {
} else if (!user.equals(other.user))
return false;
return true;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment