using hibernate to fetch entries now, able to fetch entries in one go

This commit is contained in:
Jeremie Panzer
2013-03-26 16:02:26 +01:00
parent 654cee9a1f
commit 0d3a93cdf0
9 changed files with 159 additions and 81 deletions

View File

@@ -1,16 +1,20 @@
package com.commafeed.backend.model;
import java.util.Date;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.apache.commons.codec.binary.StringUtils;
@Entity
@Table(name = "FEEDENTRIES")
@SuppressWarnings("serial")
@@ -26,7 +30,7 @@ public class FeedEntry extends AbstractModel {
private String title;
@Lob
private String content;
private byte[] content;
@Column(length = 2048)
private String url;
@@ -34,6 +38,9 @@ public class FeedEntry extends AbstractModel {
@Temporal(TemporalType.TIMESTAMP)
private Date updated;
@OneToMany(mappedBy = "entry")
private Set<FeedEntryStatus> statuses;
public String getGuid() {
return guid;
}
@@ -51,11 +58,11 @@ public class FeedEntry extends AbstractModel {
}
public String getContent() {
return content;
return StringUtils.newStringUtf8(content);
}
public void setContent(String content) {
this.content = content;
this.content = StringUtils.getBytesUtf8(content);
}
public String getUrl() {
@@ -82,4 +89,12 @@ public class FeedEntry extends AbstractModel {
this.feed = feed;
}
public Set<FeedEntryStatus> getStatuses() {
return statuses;
}
public void setStatuses(Set<FeedEntryStatus> statuses) {
this.statuses = statuses;
}
}