You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by am...@apache.org on 2007/12/17 10:46:17 UTC

svn commit: r604808 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/ main/java/org/apache/cayenne/access/jdbc/ main/java/org/apache/cayenne/conf/ main/java/org/apache/cayenne/dba/db2/ main/java/org...

Author: amaniatis
Date: Mon Dec 17 01:46:14 2007
New Revision: 604808

URL: http://svn.apache.org/viewvc?rev=604808&view=rev
Log:
EmbeddedAttribute now extends ObjAttribute and a range of generics that this simplifies are now implemented. More yet to get done for CAY-944, but this is a start.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeSaveDelegate.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/db2/DB2Adapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseAdapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityInheritanceTree.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DbMerger.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchSelectQuery.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchTreeNode.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EntityMergeSupport.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainInsertBucket.java Mon Dec 17 01:46:14 2007
@@ -136,7 +136,7 @@
                 }
 
                 // handle meaningful PK
-                ObjAttribute objAttr = objEntity.getAttributeForDbAttribute(dbAttr);
+                ObjAttribute objAttr = (ObjAttribute) objEntity.getAttributeForDbAttribute(dbAttr);
                 if (objAttr != null) {
 
                     Object value = descriptor

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataNodeSyncQualifierDescriptor.java Mon Dec 17 01:46:14 2007
@@ -44,7 +44,7 @@
  */
 class DataNodeSyncQualifierDescriptor {
 
-    private List attributes;
+    private List<DbAttribute> attributes;
     private List valueTransformers;
     private boolean usingOptimisticLocking;
 
@@ -52,7 +52,7 @@
         return usingOptimisticLocking;
     }
 
-    List getAttributes() {
+    List<DbAttribute> getAttributes() {
         return attributes;
     }
 
@@ -61,7 +61,7 @@
 
         Map map = new HashMap(len * 2);
         for (int i = 0; i < len; i++) {
-            DbAttribute attribute = (DbAttribute) attributes.get(i);
+            DbAttribute attribute = attributes.get(i);
             if (!map.containsKey(attribute.getName())) {
 
                 Object value = ((Transformer) valueTransformers.get(i)).transform(diff);
@@ -73,15 +73,13 @@
     }
 
     void reset(ObjEntity entity, DbEntity dbEntity) {
-        attributes = new ArrayList(3);
+        attributes = new ArrayList<DbAttribute>(3);
         valueTransformers = new ArrayList(3);
         usingOptimisticLocking = entity.getLockType() == ObjEntity.LOCK_TYPE_OPTIMISTIC;
 
         // master PK columns
         if (entity.getDbEntity() == dbEntity) {
-            Iterator pkIt = entity.getDbEntity().getPrimaryKeys().iterator();
-            while (pkIt.hasNext()) {
-                final DbAttribute attribute = (DbAttribute) pkIt.next();
+            for (final DbAttribute attribute : entity.getDbEntity().getPrimaryKeys() ) {
                 attributes.add(attribute);
                 valueTransformers.add(new Transformer() {
 
@@ -99,10 +97,7 @@
                     dbEntity);
 
             if (masterDependentDbRel != null) {
-
-                Iterator joinsIterator = masterDependentDbRel.getJoins().iterator();
-                while (joinsIterator.hasNext()) {
-                    final DbJoin dbAttrPair = (DbJoin) joinsIterator.next();
+                for (final DbJoin dbAttrPair : masterDependentDbRel.getJoins()) {
                     DbAttribute dbAttribute = dbAttrPair.getTarget();
                     if (!attributes.contains(dbAttribute)) {
 
@@ -147,8 +142,7 @@
 
             Iterator relationshipIt = entity.getRelationships().iterator();
             while (relationshipIt.hasNext()) {
-                final ObjRelationship relationship = (ObjRelationship) relationshipIt
-                        .next();
+                final ObjRelationship relationship = (ObjRelationship) relationshipIt.next();
 
                 if (relationship.isUsedForLocking()) {
                     // only care about the first DbRelationship
@@ -156,9 +150,7 @@
                             .getDbRelationships()
                             .get(0);
 
-                    Iterator joinsIterator = dbRelationship.getJoins().iterator();
-                    while (joinsIterator.hasNext()) {
-                        final DbJoin dbAttrPair = (DbJoin) joinsIterator.next();
+                    for (final DbJoin dbAttrPair : dbRelationship.getJoins()) {
                         DbAttribute dbAttribute = dbAttrPair.getSource();
 
                         // relationship transformers override attribute transformers for

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/PrefetchProcessorJointNode.java Mon Dec 17 01:46:14 2007
@@ -202,23 +202,16 @@
         }
 
         // add class attributes
-        Iterator attributes = getResolver().getEntity().getAttributes().iterator();
-        while (attributes.hasNext()) {
-            ObjAttribute attribute = (ObjAttribute) attributes.next();
+        for (ObjAttribute attribute : getResolver().getEntity().getAttributes()) {
             String target = attribute.getDbAttributePath();
 
             appendColumn(targetSource, target, prefix + target);
         }
 
         // add relationships
-        Iterator relationships = getResolver().getEntity().getRelationships().iterator();
-        while (relationships.hasNext()) {
-            ObjRelationship rel = (ObjRelationship) relationships.next();
+        for (ObjRelationship rel : getResolver().getEntity().getRelationships()) {
             DbRelationship dbRel = rel.getDbRelationships().get(0);
-            Iterator dbAttributes = dbRel.getSourceAttributes().iterator();
-
-            while (dbAttributes.hasNext()) {
-                DbAttribute attribute = (DbAttribute) dbAttributes.next();
+            for (DbAttribute attribute : dbRel.getSourceAttributes() ){
                 String target = attribute.getName();
 
                 appendColumn(targetSource, target, prefix + target);
@@ -226,9 +219,7 @@
         }
 
         // add unmapped PK
-        Iterator pks = getResolver().getEntity().getDbEntity().getPrimaryKeys().iterator();
-        while (pks.hasNext()) {
-            DbAttribute pk = (DbAttribute) pks.next();
+        for (DbAttribute pk : getResolver().getEntity().getDbEntity().getPrimaryKeys()) {
             appendColumn(targetSource, pk.getName(), prefix + pk.getName());
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/EJBQLPathTranslator.java Mon Dec 17 01:46:14 2007
@@ -194,8 +194,7 @@
 
     private void processLastPathComponent() {
 
-        ObjAttribute attribute = (ObjAttribute) currentEntity
-                .getAttribute(lastPathComponent);
+        ObjAttribute attribute = (ObjAttribute) currentEntity.getAttribute(lastPathComponent);
 
         if (attribute != null) {
             processTerminatingAttribute(attribute);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeSaveDelegate.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeSaveDelegate.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeSaveDelegate.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conf/RuntimeSaveDelegate.java Mon Dec 17 01:46:14 2007
@@ -105,7 +105,7 @@
      * @since 1.1
      */
     public String viewLocation(String dataViewName) {
-        return (String) config.getDataViewLocations().get(dataViewName);
+        return config.getDataViewLocations().get(dataViewName);
     }
 
     public Iterator propertyNames(String domainName) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/db2/DB2Adapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/db2/DB2Adapter.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/db2/DB2Adapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/db2/DB2Adapter.java Mon Dec 17 01:46:14 2007
@@ -32,7 +32,6 @@
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
 import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
@@ -83,17 +82,15 @@
         buf.append("CREATE TABLE ").append(ent.getFullyQualifiedName()).append(" (");
 
         // columns
-        Iterator<Attribute> it = ent.getAttributes().iterator();
+        Iterator<DbAttribute> it = ent.getAttributes().iterator();
         boolean first = true;
         while (it.hasNext()) {
-            if (first) {
+            if (first)
                 first = false;
-            }
-            else {
+            else
                 buf.append(", ");
-            }
 
-            DbAttribute at = (DbAttribute) it.next();
+            DbAttribute at = it.next();
 
             // attribute may not be fully valid, do a simple check
             if (at.getType() == TypesMapping.NOT_DEFINED) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseAdapter.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/frontbase/FrontBaseAdapter.java Mon Dec 17 01:46:14 2007
@@ -28,7 +28,6 @@
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
 import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.query.Query;
@@ -90,17 +89,15 @@
         buf.append("CREATE TABLE ").append(ent.getFullyQualifiedName()).append(" (");
 
         // columns
-        Iterator<Attribute> it = ent.getAttributes().iterator();
+        Iterator<DbAttribute> it = ent.getAttributes().iterator();
         boolean first = true;
         while (it.hasNext()) {
-            if (first) {
+            if (first)
                 first = false;
-            }
-            else {
+            else
                 buf.append(", ");
-            }
 
-            DbAttribute at = (DbAttribute) it.next();
+            DbAttribute at = it.next();
 
             // attribute may not be fully valid, do a simple check
             if (at.getType() == TypesMapping.NOT_DEFINED) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/ingres/IngresAdapter.java Mon Dec 17 01:46:14 2007
@@ -29,7 +29,6 @@
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
 import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 
@@ -62,17 +61,15 @@
         buf.append("CREATE TABLE ").append(ent.getFullyQualifiedName()).append(" (");
 
         // columns
-        Iterator<Attribute> it = ent.getAttributes().iterator();
+        Iterator<DbAttribute> it = ent.getAttributes().iterator();
         boolean first = true;
         while (it.hasNext()) {
-            if (first) {
+            if (first)
                 first = false;
-            }
-            else {
+            else
                 buf.append(", ");
-            }
 
-            DbAttribute at = (DbAttribute) it.next();
+            DbAttribute at = it.next();
 
             // attribute may not be fully valid, do a simple check
             if (at.getType() == TypesMapping.NOT_DEFINED) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/postgres/PostgresAdapter.java Mon Dec 17 01:46:14 2007
@@ -31,7 +31,6 @@
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.PkGenerator;
 import org.apache.cayenne.dba.TypesMapping;
-import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.merge.MergerFactory;
@@ -123,17 +122,15 @@
         buf.append("CREATE TABLE ").append(ent.getFullyQualifiedName()).append(" (");
 
         // columns
-        Iterator<Attribute> it = ent.getAttributes().iterator();
+        Iterator<DbAttribute> it = ent.getAttributes().iterator();
         boolean first = true;
         while (it.hasNext()) {
-            if (first) {
+            if (first)
                 first = false;
-            }
-            else {
+            else
                 buf.append(", ");
-            }
 
-            DbAttribute at = (DbAttribute) it.next();
+            DbAttribute at = it.next();
 
             // attribute may not be fully valid, do a simple check
             if (at.getType() == TypesMapping.NOT_DEFINED) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/DbEntity.java Mon Dec 17 01:46:14 2007
@@ -162,7 +162,7 @@
     public Collection<DbAttribute> getPrimaryKeys() {
         return Collections.unmodifiableCollection(primaryKey);
     }
-    
+
     /**
      * @deprecated since 3.0 use {@link #getPrimaryKeys()} that returns a collection.
      */
@@ -171,6 +171,14 @@
     }
 
     /**
+     * Returns a Collection of all attributes that either belong to this DbEntity or
+     * inherited.
+     */
+    public Collection<DbAttribute> getAttributes() {
+        return (Collection<DbAttribute>) super.getAttributes();
+    }
+
+    /**
      * Returns an unmodifiable collection of DbAttributes that are generated by the
      * database.
      * 
@@ -181,8 +189,26 @@
     }
 
     /**
+     * Adds a new attribute to this entity.
+     * 
+     * @throws IllegalArgumentException if Attribute has no name or there is an existing
+     *             attribute with the same name
+     * @throws IllegalArgumentException if a relationship has the same name as this
+     *             attribute
+     * @since 3.0
+     */
+    public void addAttribute(DbAttribute attr) {
+        super.addAttribute(attr);
+        this.dbAttributeAdded(new AttributeEvent(this, attr, this, MapEvent.ADD));
+    }
+
+    /**
      * Overrides super to fire an AttributeEvent.
+     * 
+     * @deprecated in favour of {@link #addAttribute(DbAttribute attr)}. Scheduled for
+     *             removal in Cayenne 4.
      */
+    @Deprecated
     public void addAttribute(Attribute attr) {
         super.addAttribute(attr);
         this.dbAttributeAdded(new AttributeEvent(this, attr, this, MapEvent.ADD));
@@ -190,7 +216,7 @@
 
     /**
      * Removes attribute from the entity, removes any relationship joins containing this
-     * attribute.
+     * attribute. Does nothing if the attribute name is not found.
      * 
      * @see org.apache.cayenne.map.Entity#removeAttribute(String)
      */
@@ -202,13 +228,9 @@
 
         DataMap map = getDataMap();
         if (map != null) {
-            Iterator<DbEntity> ents = map.getDbEntities().iterator();
-            while (ents.hasNext()) {
-                DbEntity ent = ents.next();
-                Iterator<Relationship> it = ent.getRelationships().iterator();
-                while (it.hasNext()) {
-                    DbRelationship rel = (DbRelationship) it.next();
-                    Iterator<DbJoin> joins = rel.getJoins().iterator();
+            for (DbEntity ent : map.getDbEntities()) {
+                for (DbRelationship relationship : ent.getRelationships()) {
+                    Iterator<DbJoin> joins = relationship.getJoins().iterator();
                     while (joins.hasNext()) {
                         DbJoin join = joins.next();
                         if (join.getSource() == attr || join.getTarget() == attr) {
@@ -229,7 +251,15 @@
         this.dbAttributeRemoved(new AttributeEvent(this, null, this, MapEvent.REMOVE));
     }
 
-    public Iterator<Object> resolvePathComponents(Expression pathExp) throws ExpressionException {
+    /**
+     * Returns a Collection of relationships from this entity or inherited.
+     */
+    public Collection<DbRelationship> getRelationships() {
+        return (Collection<DbRelationship>) super.getRelationships();
+    }
+
+    public Iterator<Object> resolvePathComponents(Expression pathExp)
+            throws ExpressionException {
         if (pathExp.getType() != Expression.DB_PATH) {
             throw new ExpressionException("Invalid expression type: '"
                     + pathExp.expName()
@@ -239,6 +269,10 @@
         return new PathIterator((String) pathExp.getOperand(0));
     }
 
+    /**
+     * Set the primary key generator for this entity. If null is passed, nothing is
+     * changed.
+     */
     public void setPrimaryKeyGenerator(DbKeyGenerator primaryKeyGenerator) {
         this.primaryKeyGenerator = primaryKeyGenerator;
         if (primaryKeyGenerator != null) {
@@ -246,13 +280,16 @@
         }
     }
 
+    /**
+     * Return the primary key generator for this entity.
+     */
     public DbKeyGenerator getPrimaryKeyGenerator() {
         return primaryKeyGenerator;
     }
 
     /**
-     * DbEntity property changed. May be name, attribute or relationship added or removed,
-     * etc. Attribute and relationship property changes are handled in respective
+     * DbEntity property changed event. May be name, attribute or relationship added or
+     * removed, etc. Attribute and relationship property changes are handled in respective
      * listeners.
      * 
      * @since 1.2
@@ -270,10 +307,9 @@
             if (map != null) {
                 // handle all of the relationship target names that need to be changed
                 for (DbEntity dbe : map.getDbEntities()) {
-                    for (Relationship relationship : dbe.getRelationships()) {
-                        DbRelationship rel = (DbRelationship) relationship;
-                        if (rel.getTargetEntity() == this) {
-                            rel.setTargetEntityName(newName);
+                    for (DbRelationship relationship : dbe.getRelationships()) {
+                        if (relationship.getTargetEntity() == this) {
+                            relationship.setTargetEntityName(newName);
                         }
                     }
                 }
@@ -287,12 +323,16 @@
         }
     }
 
-    /** New entity has been created/added. */
+    /**
+     * New entity has been created/added.
+     */
     public void dbEntityAdded(EntityEvent e) {
         // does nothing currently
     }
 
-    /** Entity has been removed. */
+    /**
+     * Entity has been removed.
+     */
     public void dbEntityRemoved(EntityEvent e) {
         // does nothing currently
     }
@@ -341,10 +381,9 @@
 
                     // handle all of the dependent object entity attribute changes
                     for (ObjEntity oe : map.getMappedEntities(ent)) {
-                        for (Attribute attr : oe.getAttributes()) {
-                            ObjAttribute oa = (ObjAttribute) attr;
-                            if (oa.getDbAttribute() == dbAttribute) {
-                                oa.setDbAttributeName(newName);
+                        for (ObjAttribute attr : oe.getAttributes()) {
+                            if (attr.getDbAttribute() == dbAttribute) {
+                                attr.setDbAttributeName(newName);
                             }
                         }
                     }
@@ -352,7 +391,7 @@
                     // handle all of the relationships / joins that use the changed
                     // attribute
                     for (Relationship rel : ent.getRelationships()) {
-                        for (DbJoin join : ((DbRelationship)rel).getJoins()) {
+                        for (DbJoin join : ((DbRelationship) rel).getJoins()) {
                             if (join.getSource() == dbAttribute) {
                                 join.setSourceName(newName);
                             }
@@ -644,7 +683,9 @@
             return converted.toString();
         }
 
-        private void prependReversedPath(LinkedList<String> finalPath, DbRelationship relationship) {
+        private void prependReversedPath(
+                LinkedList<String> finalPath,
+                DbRelationship relationship) {
             DbRelationship revNextDBR = relationship.getReverseRelationship();
 
             if (revNextDBR == null) {
@@ -659,7 +700,9 @@
             finalPath.addFirst(revNextDBR.getName());
         }
 
-        private void appendPath(LinkedList<String> finalPath, CayenneMapEntry pathComponent) {
+        private void appendPath(
+                LinkedList<String> finalPath,
+                CayenneMapEntry pathComponent) {
             finalPath.addLast(pathComponent.getName());
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EmbeddedAttribute.java Mon Dec 17 01:46:14 2007
@@ -35,7 +35,7 @@
  * @since 3.0
  * @author Andrus Adamchik
  */
-public class EmbeddedAttribute extends Attribute {
+public class EmbeddedAttribute extends ObjAttribute {
 
     protected String type;
     protected SortedMap<String, String> attributeOverrides;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/Entity.java Mon Dec 17 01:46:14 2007
@@ -213,7 +213,7 @@
     /**
      * Returns an unmodifiable map of relationships sorted by name.
      */
-    public SortedMap<String, Relationship> getRelationshipMap() {
+    public SortedMap<String, ? extends Relationship> getRelationshipMap() {
         // create a new instance ... earlier attempts to cache it in the entity caused
         // serialization issues (esp. with Hessian).
         return Collections.unmodifiableSortedMap(relationships);
@@ -240,7 +240,7 @@
     /**
      * Returns an unmodifiable collection of Relationships that exist in this entity.
      */
-    public Collection<Relationship> getRelationships() {
+    public Collection<? extends Relationship> getRelationships() {
         // create a new instance ... earlier attempts to cache it in the entity caused
         // serialization issues (esp. with Hessian).
         return Collections.unmodifiableCollection(relationships.values());
@@ -249,7 +249,7 @@
     /**
      * Returns an unmodifiable sorted map of entity attributes.
      */
-    public SortedMap<String, Attribute> getAttributeMap() {
+    public SortedMap<String, ? extends Attribute> getAttributeMap() {
         // create a new instance ... earlier attempts to cache it in the entity caused
         // serialization issues (esp. with Hessian).
         return Collections.unmodifiableSortedMap(attributes);
@@ -258,7 +258,7 @@
     /**
      * Returns an unmodifiable collection of entity attributes.
      */
-    public Collection<Attribute> getAttributes() {
+    public Collection<? extends Attribute> getAttributes() {
         // create a new instance ... earlier attempts to cache it in the entity caused
         // serialization issues (esp. with Hessian).
         return Collections.unmodifiableCollection(attributes.values());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityInheritanceTree.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityInheritanceTree.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityInheritanceTree.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/EntityInheritanceTree.java Mon Dec 17 01:46:14 2007
@@ -119,12 +119,12 @@
         return entity;
     }
 
-    public Collection<Attribute> allAttributes() {
+    public Collection<ObjAttribute> allAttributes() {
         if (subentities == null) {
             return entity.getAttributes();
         }
 
-        Collection<Attribute> c = new ArrayList<Attribute>();
+        Collection<ObjAttribute> c = new ArrayList<ObjAttribute>();
         appendDeclaredAttributes(c);
 
         // add base attributes if any
@@ -136,12 +136,12 @@
         return c;
     }
 
-    public Collection<Relationship> allRelationships() {
+    public Collection<ObjRelationship> allRelationships() {
         if (subentities == null) {
             return entity.getRelationships();
         }
 
-        Collection<Relationship> c = new ArrayList<Relationship>();
+        Collection<ObjRelationship> c = new ArrayList<ObjRelationship>();
         appendDeclaredRelationships(c);
 
         // add base relationships if any
@@ -153,7 +153,7 @@
         return c;
     }
 
-    protected void appendDeclaredAttributes(Collection<Attribute> c) {
+    protected void appendDeclaredAttributes(Collection<ObjAttribute> c) {
         c.addAll(entity.getDeclaredAttributes());
 
         if (subentities != null) {
@@ -163,7 +163,7 @@
         }
     }
 
-    protected void appendDeclaredRelationships(Collection<Relationship> c) {
+    protected void appendDeclaredRelationships(Collection<ObjRelationship> c) {
         c.addAll(entity.getDeclaredRelationships());
 
         if (subentities != null) {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/ObjEntity.java Mon Dec 17 01:46:14 2007
@@ -605,12 +605,12 @@
      * Returns a SortedMap of all attributes that either belong to this ObjEntity or
      * inherited.
      */
-    public SortedMap<String, Attribute> getAttributeMap() {
+    public SortedMap<String, ObjAttribute> getAttributeMap() {
         if (superEntityName == null) {
-            return super.getAttributeMap();
+            return (SortedMap<String, ObjAttribute>) super.getAttributeMap();
         }
 
-        SortedMap<String, Attribute> attributeMap = new TreeMap<String, Attribute>();
+        SortedMap<String, ObjAttribute> attributeMap = new TreeMap<String, ObjAttribute>();
         appendAttributes(attributeMap);
         return attributeMap;
     }
@@ -618,8 +618,8 @@
     /**
      * Recursively appends all attributes in the entity inheritance hierarchy.
      */
-    final void appendAttributes(Map<String, Attribute> map) {
-        map.putAll(super.getAttributeMap());
+    final void appendAttributes(Map<String, ObjAttribute> map) {
+        map.putAll((Map<String, ObjAttribute>) super.getAttributeMap());
 
         ObjEntity superEntity = getSuperEntity();
         if (superEntity != null) {
@@ -631,9 +631,9 @@
      * Returns a Collection of all attributes that either belong to this ObjEntity or
      * inherited.
      */
-    public Collection<Attribute> getAttributes() {
+    public Collection<ObjAttribute> getAttributes() {
         if (superEntityName == null) {
-            return super.getAttributes();
+            return (Collection<ObjAttribute>) super.getAttributes();
         }
 
         return getAttributeMap().values();
@@ -645,8 +645,8 @@
      * 
      * @since 1.1
      */
-    public Collection<Attribute> getDeclaredAttributes() {
-        return super.getAttributes();
+    public Collection<ObjAttribute> getDeclaredAttributes() {
+        return (Collection<ObjAttribute>) super.getAttributes();
     }
 
     /**
@@ -654,7 +654,7 @@
      * Returns null if no matching attribute is found.
      */
     public Relationship getRelationship(String name) {
-        Relationship relationship = super.getRelationship(name);
+        ObjRelationship relationship = (ObjRelationship) super.getRelationship(name);
         if (relationship != null) {
             return relationship;
         }
@@ -667,12 +667,12 @@
         return (superEntity != null) ? superEntity.getRelationship(name) : null;
     }
 
-    public SortedMap<String, Relationship> getRelationshipMap() {
+    public SortedMap<String, ObjRelationship> getRelationshipMap() {
         if (superEntityName == null) {
-            return super.getRelationshipMap();
+            return (SortedMap<String, ObjRelationship>) super.getRelationshipMap();
         }
 
-        SortedMap<String, Relationship> relationshipMap = new TreeMap<String, Relationship>();
+        SortedMap<String, ObjRelationship> relationshipMap = new TreeMap<String, ObjRelationship>();
         appendRelationships(relationshipMap);
         return relationshipMap;
     }
@@ -680,8 +680,8 @@
     /**
      * Recursively appends all relationships in the entity inheritance hierarchy.
      */
-    final void appendRelationships(Map<String, Relationship> map) {
-        map.putAll(super.getRelationshipMap());
+    final void appendRelationships(Map<String, ObjRelationship> map) {
+        map.putAll((Map<String, ObjRelationship>) super.getRelationshipMap());
 
         ObjEntity superEntity = getSuperEntity();
         if (superEntity != null) {
@@ -689,9 +689,9 @@
         }
     }
 
-    public Collection<Relationship> getRelationships() {
+    public Collection<ObjRelationship> getRelationships() {
         if (superEntityName == null) {
-            return super.getRelationships();
+            return (Collection<ObjRelationship>) super.getRelationships();
         }
 
         return getRelationshipMap().values();
@@ -703,8 +703,8 @@
      * 
      * @since 1.1
      */
-    public Collection<Relationship> getDeclaredRelationships() {
-        return super.getRelationships();
+    public Collection<ObjRelationship> getDeclaredRelationships() {
+        return (Collection<ObjRelationship>) super.getRelationships();
     }
 
     /**
@@ -739,9 +739,7 @@
      */
     public ObjRelationship getRelationshipForDbRelationship(DbRelationship dbRelationship) {
         
-        for (Map.Entry<String, Relationship> entry : getRelationshipMap().entrySet()) {
-            ObjRelationship objRel = (ObjRelationship) entry.getValue();
-
+        for (ObjRelationship objRel : getRelationshipMap().values()) {
             List<DbRelationship> relList = objRel.getDbRelationships();
             if (relList.size() != 1) {
                 continue;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DbMerger.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DbMerger.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DbMerger.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/merge/DbMerger.java Mon Dec 17 01:46:14 2007
@@ -24,7 +24,6 @@
 import java.sql.Types;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -36,7 +35,6 @@
 import org.apache.cayenne.access.DbLoader;
 import org.apache.cayenne.access.DbLoaderDelegate;
 import org.apache.cayenne.dba.DbAdapter;
-import org.apache.cayenne.map.Attribute;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
@@ -65,7 +63,10 @@
      * Create and return a {@link List} of {@link MergerToken}s to alter the given
      * {@link DataNode} to match the given {@link DataMap}
      */
-    public List<MergerToken> createMergeTokens(DbAdapter adapter, DataSource dataSource, DataMap dataMap) {
+    public List<MergerToken> createMergeTokens(
+            DbAdapter adapter,
+            DataSource dataSource,
+            DataMap dataMap) {
         factory = adapter.mergerFactory();
 
         List<MergerToken> tokens = new ArrayList<MergerToken>();
@@ -80,7 +81,8 @@
                     null,
                     new DataMap());
 
-            Map<String, DbEntity> dbEntityToDropByName = new HashMap<String, DbEntity>(detectedDataMap.getDbEntityMap());
+            Map<String, DbEntity> dbEntityToDropByName = new HashMap<String, DbEntity>(
+                    detectedDataMap.getDbEntityMap());
 
             for (DbEntity dbEntity : dataMap.getDbEntities()) {
                 String tableName = dbEntity.getName();
@@ -128,19 +130,20 @@
         return tokens;
     }
 
-    private void checkRows(List<MergerToken> tokens, DbEntity dbEntity, DbEntity detectedEntity) {
+    private void checkRows(
+            List<MergerToken> tokens,
+            DbEntity dbEntity,
+            DbEntity detectedEntity) {
 
         // columns to drop
-        for (Iterator<Attribute> it = detectedEntity.getAttributes().iterator(); it.hasNext();) {
-            DbAttribute detected = (DbAttribute) it.next();
+        for (DbAttribute detected : detectedEntity.getAttributes()) {
             if (findDbAttribute(dbEntity, detected.getName()) == null) {
                 tokens.add(factory.createDropColumToDb(dbEntity, detected));
             }
         }
 
         // columns to add or modify
-        for (Iterator<Attribute> it = dbEntity.getAttributes().iterator(); it.hasNext();) {
-            DbAttribute attr = (DbAttribute) it.next();
+        for (DbAttribute attr : dbEntity.getAttributes()) {
             String columnName = attr.getName().toUpperCase();
 
             DbAttribute detected = findDbAttribute(detectedEntity, columnName);
@@ -170,7 +173,10 @@
                 case Types.VARCHAR:
                 case Types.CHAR:
                     if (attr.getMaxLength() != detected.getMaxLength()) {
-                        tokens.add(factory.createSetColumnTypeToDb(dbEntity, detected, attr));
+                        tokens.add(factory.createSetColumnTypeToDb(
+                                dbEntity,
+                                detected,
+                                attr));
                     }
                     break;
             }
@@ -194,8 +200,7 @@
      * case insensitive search for a {@link DbAttribute} in a {@link DbEntity} by name
      */
     private DbAttribute findDbAttribute(DbEntity entity, String caseInsensitiveName) {
-        for (Iterator<Attribute> it = entity.getAttributes().iterator(); it.hasNext();) {
-            DbAttribute a = (DbAttribute) it.next();
+        for (DbAttribute a : entity.getAttributes()) {
             if (a.getName().equalsIgnoreCase(caseInsensitiveName)) {
                 return a;
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchSelectQuery.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchSelectQuery.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchSelectQuery.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchSelectQuery.java Mon Dec 17 01:46:14 2007
@@ -49,7 +49,7 @@
 
     // TODO, Andrus 11/17/2005 - i guess we should deprecate
     // SelectQuery.customDbAttribute, replacing it with "resultPaths" mechanism.
-    protected Collection resultPaths;
+    protected Collection<String> resultPaths;
 
     /**
      * Creates a new disjoint prefetch select query.
@@ -155,7 +155,7 @@
      * 
      * @since 1.2
      */
-    public Collection getResultPaths() {
+    public Collection<String> getResultPaths() {
         return resultPaths != null
                 ? Collections.unmodifiableCollection(resultPaths)
                 : Collections.EMPTY_SET;
@@ -167,9 +167,9 @@
      * 
      * @since 1.2
      */
-    Collection nonNullResultPaths() {
+    Collection<String> nonNullResultPaths() {
         if (resultPaths == null) {
-            resultPaths = new HashSet();
+            resultPaths = new HashSet<String>();
         }
 
         return resultPaths;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchTreeNode.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchTreeNode.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchTreeNode.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/query/PrefetchTreeNode.java Mon Dec 17 01:46:14 2007
@@ -24,7 +24,6 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.StringTokenizer;
 
 import org.apache.cayenne.map.Entity;
@@ -55,7 +54,7 @@
     // lookup by segment) is a reasonable tradeoff considering that
     // each node has no more than a few children and lookup by name doesn't happen on
     // traversal, only during creation.
-    protected Collection children;
+    protected Collection<PrefetchTreeNode> children;
 
     /**
      * Creates a root node of the prefetch tree. Children can be added to the parent by
@@ -119,8 +118,8 @@
      * same query as the current node. Result excludes this node, regardless of its
      * semantics.
      */
-    public Collection adjacentJointNodes() {
-        Collection c = new ArrayList();
+    public Collection<PrefetchTreeNode> adjacentJointNodes() {
+        Collection<PrefetchTreeNode> c = new ArrayList<PrefetchTreeNode>();
         traverse(new AdjacentJoinsOperation(c));
         return c;
     }
@@ -128,8 +127,8 @@
     /**
      * Returns a collection of PrefetchTreeNodes in this tree with joint semantics.
      */
-    public Collection jointNodes() {
-        Collection c = new ArrayList();
+    public Collection<PrefetchTreeNode> jointNodes() {
+        Collection<PrefetchTreeNode> c = new ArrayList<PrefetchTreeNode>();
         traverse(new CollectionBuilderOperation(c, false, true, false, false));
         return c;
     }
@@ -137,8 +136,8 @@
     /**
      * Returns a collection of PrefetchTreeNodes with disjoint semantics.
      */
-    public Collection disjointNodes() {
-        Collection c = new ArrayList();
+    public Collection<PrefetchTreeNode> disjointNodes() {
+        Collection<PrefetchTreeNode> c = new ArrayList<PrefetchTreeNode>();
         traverse(new CollectionBuilderOperation(c, true, false, false, false));
         return c;
     }
@@ -146,8 +145,8 @@
     /**
      * Returns a collection of PrefetchTreeNodes that are not phantoms.
      */
-    public Collection nonPhantomNodes() {
-        Collection c = new ArrayList();
+    public Collection<PrefetchTreeNode> nonPhantomNodes() {
+        Collection<PrefetchTreeNode> c = new ArrayList<PrefetchTreeNode>();
         traverse(new CollectionBuilderOperation(c, true, true, true, false));
         return c;
     }
@@ -175,9 +174,8 @@
 
         // process children unless processing is blocked...
         if (result && children != null) {
-            Iterator it = children.iterator();
-            while (it.hasNext()) {
-                ((PrefetchTreeNode) it.next()).traverse(processor);
+            for (PrefetchTreeNode child : children) {
+                child.traverse(processor);
             }
         }
 
@@ -268,7 +266,7 @@
         }
 
         if (children == null) {
-            children = new ArrayList(4);
+            children = new ArrayList<PrefetchTreeNode>(4);
         }
 
         children.add(child);
@@ -293,11 +291,9 @@
 
     protected PrefetchTreeNode getChild(String segment) {
         if (children != null) {
-            Iterator it = children.iterator();
-            while (it.hasNext()) {
-                PrefetchTreeNode next = (PrefetchTreeNode) it.next();
-                if (segment.equals(next.getName())) {
-                    return next;
+            for (PrefetchTreeNode child : children) {
+                if (segment.equals(child.getName())) {
+                    return child;
                 }
             }
         }
@@ -312,7 +308,7 @@
     /**
      * Returns an unmodifiable collection of children.
      */
-    public Collection getChildren() {
+    public Collection<PrefetchTreeNode> getChildren() {
         return children == null ? Collections.EMPTY_SET : Collections
                 .unmodifiableCollection(children);
     }
@@ -356,9 +352,7 @@
     private Object readResolve() throws ObjectStreamException {
 
         if (hasChildren()) {
-            Iterator it = children.iterator();
-            while (it.hasNext()) {
-                PrefetchTreeNode child = (PrefetchTreeNode) it.next();
+            for (PrefetchTreeNode child : children) {
                 child.parent = this;
             }
         }
@@ -412,13 +406,13 @@
     // An operation that collects all nodes in a single collection.
     class CollectionBuilderOperation implements PrefetchProcessor {
 
-        Collection nodes;
+        Collection<PrefetchTreeNode> nodes;
         boolean includePhantom;
         boolean includeDisjoint;
         boolean includeJoint;
         boolean includeUnknown;
 
-        CollectionBuilderOperation(Collection nodes, boolean includeDisjoint,
+        CollectionBuilderOperation(Collection<PrefetchTreeNode> nodes, boolean includeDisjoint,
                 boolean includeJoint, boolean includeUnknown, boolean includePhantom) {
             this.nodes = nodes;
 
@@ -463,9 +457,9 @@
 
     class AdjacentJoinsOperation implements PrefetchProcessor {
 
-        Collection nodes;
+        Collection<PrefetchTreeNode> nodes;
 
-        AdjacentJoinsOperation(Collection nodes) {
+        AdjacentJoinsOperation(Collection<PrefetchTreeNode> nodes) {
             this.nodes = nodes;
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/CayenneGeneratorTask.java Mon Dec 17 01:46:14 2007
@@ -26,7 +26,6 @@
 import org.apache.cayenne.gen.ClassGenerator;
 import org.apache.cayenne.gen.ClientClassGenerationAction;
 import org.apache.cayenne.gen.DefaultClassGenerator;
-import org.apache.cayenne.gen.MapClassGenerator;
 import org.apache.cayenne.map.DataMap;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.types.Path;

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EntityMergeSupport.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EntityMergeSupport.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EntityMergeSupport.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/util/EntityMergeSupport.java Mon Dec 17 01:46:14 2007
@@ -94,12 +94,12 @@
                 Iterator rait = getMeaningfulFKs(entity).iterator();
                 while (rait.hasNext()) {
                     DbAttribute da = (DbAttribute) rait.next();
-                    ObjAttribute oa = entity.getAttributeForDbAttribute(da);
+                    ObjAttribute oa = (ObjAttribute) entity.getAttributeForDbAttribute(da);
                     while (oa != null) {
                         String attrName = oa.getName();
                         entity.removeAttribute(attrName);
                         changed = true;
-                        oa = entity.getAttributeForDbAttribute(da);
+                        oa = (ObjAttribute) entity.getAttributeForDbAttribute(da);
                     }
                 }
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/DbLoaderTest.java Mon Dec 17 01:46:14 2007
@@ -24,7 +24,6 @@
 import java.util.Iterator;
 import java.util.List;
 
-import org.objectstyle.ashwood.dbutil.Table;
 import org.apache.cayenne.dba.TypesMapping;
 import org.apache.cayenne.map.DataMap;
 import org.apache.cayenne.map.DbAttribute;
@@ -33,6 +32,7 @@
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
 import org.apache.cayenne.unit.CayenneCase;
+import org.objectstyle.ashwood.dbutil.Table;
 
 public class DbLoaderTest extends CayenneCase {
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/dba/TypesMappingTest.java Mon Dec 17 01:46:14 2007
@@ -97,7 +97,7 @@
         TypesMapping map = createTypesMapping();
         Iterator it = map.databaseTypes.keySet().iterator();
         while (it.hasNext()) {
-            List vals = (List) map.databaseTypes.get(it.next());
+            List vals = map.databaseTypes.get(it.next());
             actualLen += vals.size();
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java?rev=604808&r1=604807&r2=604808&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java (original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/map/ObjRelationshipTest.java Mon Dec 17 01:46:14 2007
@@ -171,7 +171,7 @@
         relationship.refreshFromPath(false);
         assertFalse(relationship.dbRelationshipsRefreshNeeded);
 
-        List resolvedPath = relationship.getDbRelationships();
+        List<DbRelationship> resolvedPath = relationship.getDbRelationships();
         assertEquals(2, resolvedPath.size());
         assertSame(dummyR, resolvedPath.get(0));
         assertSame(pathR, resolvedPath.get(1));