Hi I'm using REST WebServices to publish Update objects to the server. These are stored into the database. Here is Update entity:
I can successfully publish updates to the database, but I do not know, how to download them to the client.PHP Code:import java.sql.Blob;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
@Entity
@Table(name="Sys_Update")
@XmlRootElement(name="update")
public class Update {
@Id
@Column(name = "uuid")
private String uuid = null;
@NotNull
@Size(min = 1, max = 10)
@Column(name = "version", length=10, nullable=false)
private String version;
@NotNull
@Size(min = 1, max = 30)
@Column(name = "author", length=30, nullable=false)
private String author;
@NotNull
@Size(min = 1, max = 100)
@Column(name = "fileName", length=100, nullable=false)
private String fileName;
@Size(max = 5000)
@Column(name = "description", length=5000)
private String description;
@NotNull
@Column(name = "size", nullable=false)
private Long size;
@Lob
@NotNull
@Basic(fetch = FetchType.LAZY)
@Column(name="data", nullable=false)
private Blob data;
@Column(name = "creationDate", nullable=false)
private Date creationDate;
@Column(name = "publishDate")
private Date publishDate;
public String getUuid() {
return uuid;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public Date getPublishDate() {
return publishDate;
}
public void setPublishDate(Date publishDate) {
this.publishDate = publishDate;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Long getSize() {
return size;
}
public void setSize(Long size) {
this.size = size;
}
public Blob getData() {
return data;
}
public void setData(Blob data) {
this.data = data;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
I'd like to get a List of updates from the server.
This is my server method which is not working:
Of course the Blob field fails. How can I successfully do that? Any help or directions appreciated.PHP Code:@SuppressWarnings("unchecked")
public UpdateList getAll(String localisation) throws Exception {
DetachedCriteria criteria = DetachedCriteria.forClass(Update.class, "update").addOrder(Order.desc("publishDate"));
List<Update> updates = this.hibernateTemplate.findByCriteria(criteria);
UpdateList updateList = new UpdateList();
updateList.setData(updates);
return updateList;
}
Tnx,
Bojan


Reply With Quote
