bstlboard-back/src/main/java/de/bstly/board/model/Bookmarks.java

91 lines
1.6 KiB
Java

/**
*
*/
package de.bstly.board.model;
import java.util.List;
import jakarta.persistence.CollectionTable;
import jakarta.persistence.Column;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
import jakarta.persistence.EntityListeners;
import jakarta.persistence.FetchType;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import com.google.common.collect.Lists;
/**
* The Class Bookmarks.
*/
@Entity
@Table(name = "bookmarks")
@EntityListeners({ AuditingEntityListener.class })
public class Bookmarks {
@Id
@Column(name = "username", nullable = false)
private String username;
@ElementCollection(fetch = FetchType.EAGER)
@CollectionTable(name = "bookmark_entries")
private List<Long> entries;
/**
* Instantiates a new bookmarks.
*/
public Bookmarks() {
super();
}
/**
* Instantiates a new bookmarks.
*
* @param username the username
*/
public Bookmarks(String username) {
super();
this.username = username;
this.entries = Lists.newArrayList();
}
/**
* Gets the username.
*
* @return the username
*/
public String getUsername() {
return username;
}
/**
* Sets the username.
*
* @param username the new username
*/
public void setUsername(String username) {
this.username = username;
}
/**
* Gets the entries.
*
* @return the entries
*/
public List<Long> getEntries() {
return entries;
}
/**
* Sets the entries.
*
* @param entries the new entries
*/
public void setEntries(List<Long> entries) {
this.entries = entries;
}
}