From 173b6db7d9ed8c1115ec634de68b7a9d8f70f812 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 3 Oct 2013 12:10:05 +0200 Subject: add DBExceptionStoreImpl to store Exceptions in DB instead of in a HashMap --- .../id/commons/db/dao/session/ExceptionStore.java | 103 +++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java (limited to 'id/server/moa-id-commons/src/main/java/at/gv') diff --git a/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java new file mode 100644 index 000000000..c439cdb64 --- /dev/null +++ b/id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java @@ -0,0 +1,103 @@ +package at.gv.egovernment.moa.id.commons.db.dao.session; + +import java.io.Serializable; +import java.util.Date; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; +import javax.persistence.Id; +import javax.persistence.Lob; +import javax.persistence.NamedQueries; +import javax.persistence.NamedQuery; +import javax.persistence.Table; + +import org.hibernate.annotations.DynamicUpdate; + + + +@Entity +@DynamicUpdate(value=true) +@Table(name = "exceptionstore") +@NamedQueries({ + @NamedQuery(name="getExceptionWithID", query = "select exceptionstore from ExceptionStore exceptionstore where exceptionstore.exid = :id"), + @NamedQuery(name="getExceptionWithTimeOut", query = "select exceptionstore from ExceptionStore exceptionstore where exceptionstore.timestamp < :timeout") +}) + +public class ExceptionStore implements Serializable{ + + private static final long serialVersionUID = 1L; + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id", unique=true, nullable=false) + private long id; + + @Column(name = "exid", unique=true, nullable=false) + private String exid; + + @Column(name = "exception", nullable=false) + @Lob private byte [] exception; + + @Column(name = "timestamp", nullable=false) + private Date timestamp; + + /** + * @return the id + */ + public long getId() { + return id; + } + + /** + * @param id the id to set + */ + public void setId(long id) { + this.id = id; + } + + /** + * @return the exid + */ + public String getExid() { + return exid; + } + + /** + * @param exid the exid to set + */ + public void setExid(String exid) { + this.exid = exid; + } + + /** + * @return the exception + */ + public byte[] getException() { + return exception; + } + + /** + * @param exception the exception to set + */ + public void setException(byte[] exception) { + this.exception = exception; + } + + /** + * @return the timestamp + */ + public Date getTimestamp() { + return timestamp; + } + + /** + * @param timestamp the timestamp to set + */ + public void setTimestamp(Date timestamp) { + this.timestamp = timestamp; + } + + +} -- cgit v1.2.3