aboutsummaryrefslogtreecommitdiff
path: root/id/server/moa-id-commons
diff options
context:
space:
mode:
authorThomas Lenz <tlenz@iaik.tugraz.at>2013-10-03 12:10:05 +0200
committerThomas Lenz <tlenz@iaik.tugraz.at>2013-10-03 12:10:05 +0200
commit173b6db7d9ed8c1115ec634de68b7a9d8f70f812 (patch)
treecf994f1de5486ddab394f4c8fcb706e0c617e8cc /id/server/moa-id-commons
parenta49bdd53d713a73f706d120f3e386a1ed71ae67e (diff)
downloadmoa-id-spss-173b6db7d9ed8c1115ec634de68b7a9d8f70f812.tar.gz
moa-id-spss-173b6db7d9ed8c1115ec634de68b7a9d8f70f812.tar.bz2
moa-id-spss-173b6db7d9ed8c1115ec634de68b7a9d8f70f812.zip
add DBExceptionStoreImpl to store Exceptions in DB instead of in a HashMap
Diffstat (limited to 'id/server/moa-id-commons')
-rw-r--r--id/server/moa-id-commons/src/main/java/at/gv/egovernment/moa/id/commons/db/dao/session/ExceptionStore.java103
-rw-r--r--id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml1
2 files changed, 104 insertions, 0 deletions
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;
+ }
+
+
+}
diff --git a/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml b/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml
index 4841481b6..e40c8b8a9 100644
--- a/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml
+++ b/id/server/moa-id-commons/src/main/resources/config/hibernate_moasession.cfg.xml
@@ -10,5 +10,6 @@
<mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.AuthenticatedSessionStore"/>
<mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.OASessionStore"/>
<mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.OldSSOSessionIDStore"/>
+ <mapping class="at.gv.egovernment.moa.id.commons.db.dao.session.ExceptionStore"/>
</session-factory>
</hibernate-configuration> \ No newline at end of file