db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jakob Braeuchi <jbraeu...@gmx.ch>
Subject Re: New auto-xxx handling
Date Sat, 27 Mar 2004 21:18:46 GMT
hi armin,

thanks for the great job :)
there's an issue OJB245 which may affect the linkin/unlinking of objects.
when unlinking fk-fields are set to 'null'. this is a problem when th fk is part 
of the pk.

this is the comment from OJB245 (line numbers from older revision !):

Creating and storing objects (A) with null reference to object (B), OJB sets 
every FK_B in (A), part of PK_B to null. This is OK, except when FK_B in A is 
part of PK of (A).

My hack:

--- PersistenceBrokerImpl.java
+++ PersistenceBrokerImpl.java.new
@@ -763,6 +763,7 @@

          for (int i = 0; i < objFkFields.length; i++)
          {
+            if( objFkFields[i].isPrimaryKey() == false )
                  objFkFields[i].getPersistentField().set(realObj, refPkValues 
!= null ? refPkValues[i].getValue(): null);
          }
      }


jakob

Armin Waibel wrote:
> Hi all,
> 
> I checked in the new auto-update/-delete stuff. This should be 100% 
> backward compatible with the old stuff.
> 
> auto-update/-delete now support the following values
> none, link, object, false, true
> 
> BrokerHelper has new methods used to handle the new 'none' setting. 
> These methods allow to assign/remove the FK in the referenced objects.
> 
> public void link(Object obj, boolean insert)
> public boolean link(Object obj, String attributeName, boolean insert)
> public void unlink(Object obj)
> public boolean unlink(Object obj, String attributeName)
> 
> I added new test cases to check the new settings:
> ...broker.CollectionTest2
> ...broker.M2NTest
> It is not possible to test all combinations of auto-xxx settings. If you 
> miss some, please enhance these new tests. We need an similar test for 
> 1:1 relations too.
> 
> More details can be found in the "auto-xxx setting (PART II)" thread on 
> dev-list and in near future in documentation (will start with this work 
> today).
> 
> All test pass, but please review and check my made changes (maybe with 
> your local tests).
> 
> regards,
> Armin
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message