import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
+import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Basic(optional = false)
@NotNull
@Column(name = "id")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN_SEQUENCE")
+ @SequenceGenerator(name = "SEQ_GEN_SEQUENCE", allocationSize = 50)
private long id;
@Size(max = 255)
@Column(name = "name")
@Column(name = "deletion_date")
@Temporal(TemporalType.TIMESTAMP)
private Date deletionDate;
- @OneToMany(cascade = CascadeType.ALL)
- private Collection<Chunk> chunkCollection;
@Column(name = "attribute_group_id")
private long attributeGroupId;
this.deletionDate = deletionDate;
}
- @XmlTransient
- public Collection<Chunk> getChunkCollection() {
- return chunkCollection;
- }
-
- public void setChunkCollection(Collection<Chunk> chunkCollection) {
- this.chunkCollection = chunkCollection;
- }
-
public long getAttributeGroupId() {
return attributeGroupId;
}
public static GDEFile fromFileTO(FileTO fto) {
GDEFile f = new GDEFile();
f.checksum = fto.getChecksum();
-
- f.chunkCollection = new ArrayList<>();
- Collection<ChunkTO> chunks = fto.getChunkCollection();
- for (ChunkTO cto : chunks) {
- f.chunkCollection.add(Chunk.fromChunkTO(cto));
- }
f.creationDate = fto.getCreationDate();
f.deleted = fto.getDeleted();
public FileTO toFileTO() {
FileTO fto = new FileTO();
fto.setChecksum(this.checksum);
-
- Collection<ChunkTO> ctos = new ArrayList<>();
- for (Chunk c : this.chunkCollection) {
- ctos.add(c.toChunkTO());
- }
- fto.setChunkCollection(ctos);
-
+
fto.setCreationDate(this.creationDate);
fto.setDeleted(this.deleted);
fto.setDeletionDate(this.deletionDate);
hash = 29 * hash + Objects.hashCode(this.valid);
hash = 29 * hash + Objects.hashCode(this.deleted);
hash = 29 * hash + Objects.hashCode(this.deletionDate);
- hash = 29 * hash + Objects.hashCode(this.chunkCollection);
hash = 29 * hash + (int) (this.attributeGroupId ^ (this.attributeGroupId >>> 32));
return hash;
}
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
+import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Basic(optional = false)
@NotNull
@Column(name = "id")
+ @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "SEQ_GEN_SEQUENCE")
+ @SequenceGenerator(name = "SEQ_GEN_SEQUENCE", allocationSize = 50)
private long id;
@Size(max = 255)
@Column(name = "name")