You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@click.apache.org by aa...@apache.org on 2010/06/18 18:16:16 UTC

svn commit: r956037 - /click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneUtils.java

Author: aadrian
Date: Fri Jun 18 16:16:16 2010
New Revision: 956037

URL: http://svn.apache.org/viewvc?rev=956037&view=rev
Log:
use non-deprecated method for getting the PKs

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneUtils.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneUtils.java?rev=956037&r1=956036&r2=956037&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneUtils.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/cayenne/CayenneUtils.java Fri Jun 18 16:16:16 2010
@@ -18,6 +18,7 @@
  */
 package org.apache.click.extras.cayenne;
 
+import java.util.Collection;
 import java.util.List;
 
 import org.apache.click.util.ClickUtils;
@@ -72,14 +73,14 @@ public final class CayenneUtils {
             throw new RuntimeException(msg);
         }
 
-        List pkAttributes = dbEntity.getPrimaryKey();
+        Collection<DbAttribute> pkAttributes = dbEntity.getPrimaryKeys();
         if (pkAttributes.size() != 1) {
             String msg = "PK contains " + pkAttributes.size()
                 + " columns, expected 1.";
             throw new RuntimeException(msg);
         }
 
-        DbAttribute attr = (DbAttribute) pkAttributes.get(0);
+        DbAttribute attr = pkAttributes.iterator().next();
 
         return new ObjectId(entity.getName(), attr.getName(), pk);
     }
@@ -144,14 +145,14 @@ public final class CayenneUtils {
                     + objEntity.getName());
         }
 
-        List pkAttributes = dbEntity.getPrimaryKey();
+        Collection<DbAttribute> pkAttributes = dbEntity.getPrimaryKeys();
         if (pkAttributes.size() != 1) {
             throw new CayenneRuntimeException("PK contains "
                     + pkAttributes.size()
                     + " columns, expected 1.");
         }
 
-        DbAttribute attr = (DbAttribute) pkAttributes.get(0);
+        DbAttribute attr = pkAttributes.iterator().next();
 
         String className = TypesMapping.getJavaBySqlType(attr.getType());
 
@@ -190,14 +191,14 @@ public final class CayenneUtils {
                     + objEntity.getName());
         }
 
-        List pkAttributes = dbEntity.getPrimaryKey();
+        Collection<DbAttribute> pkAttributes = dbEntity.getPrimaryKeys();
         if (pkAttributes.size() != 1) {
             throw new CayenneRuntimeException("PK contains "
                     + pkAttributes.size()
                     + " columns, expected 1.");
         }
 
-        DbAttribute attr = (DbAttribute) pkAttributes.get(0);
+        DbAttribute attr = pkAttributes.iterator().next();
 
         return attr.getName();
     }