cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject [cxf-fediz] 02/02: FEDIZ-235 - Set unique=true for the OpenJPA Index values
Date Thu, 13 Dec 2018 11:31:49 GMT
This is an automated email from the ASF dual-hosted git repository.

coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git

commit e6daa71762fa72fca147141fb1b5be8082fc1ca4
Author: Colm O hEigeartaigh <coheigea@apache.org>
AuthorDate: Thu Dec 13 11:30:27 2018 +0000

    FEDIZ-235 - Set unique=true for the OpenJPA Index values
---
 .../service/idp/service/jpa/ApplicationEntity.java |  2 +-
 .../fediz/service/idp/service/jpa/ClaimEntity.java |  2 +-
 .../service/idp/service/jpa/EntitlementEntity.java |  2 +-
 .../fediz/service/idp/service/jpa/IdpEntity.java   |  2 +-
 .../fediz/service/idp/service/jpa/RoleEntity.java  |  2 +-
 .../service/idp/service/jpa/TrustedIdpEntity.java  |  2 +-
 .../idp-core/src/main/resources/META-INF/orm.xml   | 36 ++--------------------
 7 files changed, 9 insertions(+), 39 deletions(-)

diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
index a6c930a..698aeba 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ApplicationEntity.java
@@ -37,7 +37,7 @@ public class ApplicationEntity {
     @Id
     private int id;
 
-    @Index
+    @Index(unique = true)
     @NotNull
     private String realm;  //wtrealm, whr
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java
index e967844..d44557d 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/ClaimEntity.java
@@ -30,7 +30,7 @@ public class ClaimEntity {
     @Id
     private int id;
 
-    @Index
+    @Index(unique = true)
     @NotNull
     private String claimType;
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
index dbb169b..292bf57 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/EntitlementEntity.java
@@ -29,7 +29,7 @@ public class EntitlementEntity {
     @Id
     private int id;
 
-    @Index
+    @Index(unique = true)
     private String name;
 
     private String description;
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
index 27cd33e..31ad127 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/IdpEntity.java
@@ -46,7 +46,7 @@ public class IdpEntity {
 
     // Unique
     // fed:TargetScope
-    @Index
+    @Index(unique = true)
     @NotNull
     private String realm; // wtrealm, whr
 
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
index eb7c141..7ec39c6 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/RoleEntity.java
@@ -34,7 +34,7 @@ public class RoleEntity {
     @Id
     private int id;
 
-    @Index
+    @Index(unique = true)
     private String name;
 
     private String description;
diff --git a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
index 9ee23a9..4a514ed 100644
--- a/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
+++ b/services/idp-core/src/main/java/org/apache/cxf/fediz/service/idp/service/jpa/TrustedIdpEntity.java
@@ -44,7 +44,7 @@ public class TrustedIdpEntity {
     private int id;
 
     //@Column(name = "REALM", nullable = true, length = FIELD_LENGTH)
-    @Index
+    @Index(unique = true)
     @NotNull
     private String realm;  //wtrealm, whr
 
diff --git a/services/idp-core/src/main/resources/META-INF/orm.xml b/services/idp-core/src/main/resources/META-INF/orm.xml
index e9c2bd6..0c4c0a0 100644
--- a/services/idp-core/src/main/resources/META-INF/orm.xml
+++ b/services/idp-core/src/main/resources/META-INF/orm.xml
@@ -23,11 +23,6 @@
     version="2.0">
 
     <entity class="org.apache.cxf.fediz.service.idp.service.jpa.ClaimEntity">
-        <table>
-            <unique-constraint>
-                <column-name>claimtype</column-name>
-            </unique-constraint>
-        </table>
         <attributes>
             <id name="id">
                 <generated-value generator="SEQ_Claim"
@@ -39,11 +34,6 @@
     </entity>
 
     <entity class="org.apache.cxf.fediz.service.idp.service.jpa.IdpEntity">
-        <table>
-            <unique-constraint>
-                <column-name>realm</column-name>
-            </unique-constraint>
-        </table>
         <attributes>
             <id name="id">
                 <generated-value generator="SEQ_IDP"
@@ -87,11 +77,6 @@
 
     <entity
         class="org.apache.cxf.fediz.service.idp.service.jpa.ApplicationEntity">
-        <table>
-            <unique-constraint>
-                <column-name>realm</column-name>
-            </unique-constraint>
-        </table>
         <attributes>
             <id name="id">
                 <generated-value generator="SEQ_Application"
@@ -104,11 +89,6 @@
 
     <entity
         class="org.apache.cxf.fediz.service.idp.service.jpa.TrustedIdpEntity">
-        <table>
-            <unique-constraint>
-                <column-name>realm</column-name>
-            </unique-constraint>
-        </table>
         <attributes>
             <id name="id">
                 <generated-value generator="SEQ_TrustedIDP"
@@ -137,13 +117,8 @@
             </id>
         </attributes>
     </entity>
-    
+
     <entity class="org.apache.cxf.fediz.service.idp.service.jpa.EntitlementEntity">
-        <table>
-            <unique-constraint>
-                <column-name>name</column-name>
-            </unique-constraint>
-        </table>
         <attributes>
             <id name="id">
                 <generated-value generator="SEQ_Entitlement"
@@ -153,13 +128,8 @@
             </id>
         </attributes>
     </entity>
-    
+
     <entity class="org.apache.cxf.fediz.service.idp.service.jpa.RoleEntity">
-        <table>
-            <unique-constraint>
-                <column-name>name</column-name>
-            </unique-constraint>
-        </table>
         <attributes>
             <id name="id">
                 <generated-value generator="SEQ_ROLE"
@@ -179,5 +149,5 @@
             </many-to-many>
         </attributes>
     </entity>
-    
+
 </entity-mappings>


Mime
View raw message