db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/core PersistenceBrokerImpl.java
Date Sat, 05 Jul 2003 11:08:36 GMT
brj         2003/07/05 04:08:36

  Modified:    src/java/org/apache/ojb/broker/core
                        PersistenceBrokerImpl.java
  Log:
  assign fk only for auto-update=true
  
  Revision  Changes    Path
  1.24      +14 -4     db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java
  
  Index: PersistenceBrokerImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/PersistenceBrokerImpl.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- PersistenceBrokerImpl.java	4 Jul 2003 21:45:18 -0000	1.23
  +++ PersistenceBrokerImpl.java	5 Jul 2003 11:08:36 -0000	1.24
  @@ -801,6 +801,7 @@
                   while (colIterator.hasNext())
                   {
                       Object otherObj = colIterator.next();
  +                    
                       // for m:n mapped collections store association implementing entries
                       if (cds.isMtoNRelation())
                       {
  @@ -808,12 +809,19 @@
                           storeCollectionObject(cds, otherObj);
   
                           // 2. Store indirection record
  +                        // BRJ: this could cause integrity problems because
  +                        // obj may not be stored depending on auto-update
                           storeMtoNImplementor(cds, obj, otherObj, currentMtoNKeys);
                       }
                       // for 1:n mapped collection assert proper fk assignment
                       else
                       {
  -                        assertFkAssignment(otherObj, obj, cds);
  +                        if (cds.getCascadeStore())
  +                        {
  +                            // BRJ: do not assign fk if not required
  +                            // to avoid materialization of proxy
  +                            assertFkAssignment(otherObj, obj, cds);
  +                        }    
                           storeCollectionObject(cds, otherObj);
                       }
                   }
  @@ -1248,7 +1256,9 @@
           boolean allPkNull = true;
           Identity id;
   
  -        // BRJ : check if we have non null pk values
  +        // BRJ: check if we have non null pk values
  +        // TBD  we should also check primitives 
  +        // to avoid creation of unmaterializable proxies
           for (int i = 0; i < pkVals.length; i++)
           {
               if (pkVals[i] != null)
  @@ -1257,7 +1267,7 @@
                   break;
               }
           }
  -        // BRJ : if all pk values are null there's no referenced object
  +        // BRJ: if all pk values are null there's no referenced object
           if (allPkNull)
           {
               return null;
  
  
  

Mime
View raw message