From: Richard B. <rb...@us...> - 2004-12-17 03:29:12
|
Update of /cvsroot/jcframework/dotnet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24404 Modified Files: CClassMap.vb CPersistentObject.vb Log Message: Fix for saving objects with identity columns Index: CPersistentObject.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CPersistentObject.vb,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- CPersistentObject.vb 6 Dec 2004 00:57:05 -0000 1.51 +++ CPersistentObject.vb 17 Dec 2004 03:29:01 -0000 1.52 @@ -907,6 +907,8 @@ Debug.WriteLine("The object with key " & ckey.ToString & " was already saved once") Else persistentBroker.saveObject(value) + 'Need to recalculate the key here to handle objects using identity (autonumber) keys + ckey = New CCacheKey(value) savedKeys.Add(ckey) End If Catch ex As Exception Index: CClassMap.vb =================================================================== RCS file: /cvsroot/jcframework/dotnet/CClassMap.vb,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -r1.46 -r1.47 --- CClassMap.vb 15 Dec 2004 23:46:05 -0000 1.46 +++ CClassMap.vb 17 Dec 2004 03:29:01 -0000 1.47 @@ -1165,7 +1165,7 @@ isFirst = True For i = 1 To Me.getSize AttrMap = Me.getAttributeMap(i) - If Not AttrMap.ColumnMap.IsIdentity Then + If Not AttrMap.ColumnMap.IsIdentity Or includeIdentity Then 'Shared tables that are mapped with a reference field (ie repeat of the key) 'should not have the extra key columns included. An attributemap on an attributemap 'indicates that the attribute is a reference to the parent. @@ -1193,7 +1193,7 @@ isFirst = True For i = 1 To Me.getSize AttrMap = Me.getAttributeMap(i) - If Not AttrMap.ColumnMap.IsIdentity Then + If Not AttrMap.ColumnMap.IsIdentity Or includeIdentity Then If Me.SharedTableValue Is Nothing OrElse AttrMap.AttributeMap Is Nothing Then If isFirst Then m_insertStatement.addSqlClause(RelationalDatabase.getParamHolder(i)) @@ -1219,7 +1219,7 @@ 'Add parameter values For i = 1 To Me.getSize AttrMap = Me.getAttributeMap(i) - If Not AttrMap.ColumnMap.IsIdentity Then + If Not AttrMap.ColumnMap.IsIdentity Or includeIdentity Then If Me.SharedTableValue Is Nothing OrElse AttrMap.AttributeMap Is Nothing Then m_insertStatement.addSqlParameter(i, obj.GetValueByAttribute(AttrMap.Name), AttrMap.ColumnMap) End If |