[java-opensaml COMMIT] /trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageRecord.java

noreply at shibboleth.net noreply at shibboleth.net
Wed Feb 11 09:06:02 EST 2015


Author: dfisher
Date: Wed Feb 11 09:06:00 2015
New Revision: 4218

URL: http://svn.shibboleth.net/view/java-opensaml?rev=4218&view=rev
Log:
OSJ-103

Change value to @Lob.
Define column names that match the SP schema.
Expose #resetVersion() method to support remove/add entity with a merge.

Modified:
    trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageRecord.java

Modified: trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageRecord.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageRecord.java?rev=4218&r1=4217&r2=4218&view=diff
==============================================================================
--- trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageRecord.java (original)
+++ trunk/opensaml-storage-impl/src/main/java/org/opensaml/storage/impl/JPAStorageRecord.java Wed Feb 11 09:06:00 2015
@@ -26,6 +26,7 @@
 import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.IdClass;
+import javax.persistence.Lob;
 import javax.persistence.NamedQueries;
 import javax.persistence.NamedQuery;
 import javax.persistence.Table;
@@ -57,9 +58,6 @@
     /** Length of the key column. */
     public static final int KEY_SIZE = 255;
 
-    /** Length of the value column. */
-    public static final int VALUE_SIZE = 255;
-
     /** Context string. */
     private String context;
 
@@ -110,18 +108,26 @@
     }
 
     /** {@inheritDoc} */
-    @Column(length = VALUE_SIZE, nullable = false) @Nonnull @Override public String getValue() {
+    @Lob
+    @Column(name="value", nullable = false) @Nonnull @Override public String getValue() {
         return super.getValue();
     }
 
     /** {@inheritDoc} */
-    @Column(nullable = true) @Nullable @Override public Long getExpiration() {
+    @Column(name="expires", nullable = true) @Nullable @Override public Long getExpiration() {
         return super.getExpiration();
     }
 
     /** {@inheritDoc} */
-    @Column(nullable = false) @Override public long getVersion() {
+    @Column(name="version", nullable = false) @Override public long getVersion() {
         return super.getVersion();
+    }
+
+    /**
+     * Resets the version of this storage record to 1.
+     */
+    public void resetVersion() {
+        super.setVersion(1);
     }
 
     /** {@inheritDoc} */
@@ -165,7 +171,7 @@
          * 
          * @return context
          */
-        @Column(length = CONTEXT_SIZE, nullable = false) @Nonnull public String getContext() {
+        @Column(name = "context", length = CONTEXT_SIZE, nullable = false) @Nonnull public String getContext() {
             return context;
         }
 
@@ -183,7 +189,7 @@
          * 
          * @return key
          */
-        @Column(length = KEY_SIZE, nullable = false) @Nonnull public String getKey() {
+        @Column(name="id", length = KEY_SIZE, nullable = false) @Nonnull public String getKey() {
             return key;
         }
 



More information about the commits mailing list