On Dec 12, 2007 4:25 PM, Ian Eslick <[EMAIL PROTECTED]> wrote: > You might trace the various generic functions > to see the difference in behavior during new object creation and > deserialization as a start if you want to figure this out yourself.
Right, after a couple of breakpoints and a little bit of backtracking I have a working version of this. I've added 2 new methods recreate-instance-using-class and recreate-instance. This is used by get-cached-instance and %deserialize which bypasses initialize-instance and calls appropriate methods for the persistent and persistent-object classes. Please find the attached patch. cheers, sean
New patches: [Fix instance deserialization to bypass initialization protocol [EMAIL PROTECTED] { hunk ./src/elephant/classes.lisp 28 -(defmethod initialize-instance :before ((instance persistent) - &rest initargs - &key from-oid - (sc *store-controller*)) - "Sets the OID and home controller" - (declare (ignore initargs)) +(defun initial-persistent-setup (instance &key from-oid sc) hunk ./src/elephant/classes.lisp 35 - (setf (dbcn-spc-pst instance) (controller-spec sc)) + (setf (dbcn-spc-pst instance) (controller-spec sc))) + +(defmethod initialize-instance :before ((instance persistent) + &rest initargs + &key from-oid + (sc *store-controller*)) + "Sets the OID and home controller" + (declare (ignore initargs)) + (initial-persistent-setup instance :from-oid from-oid :sc sc) hunk ./src/elephant/classes.lisp 107 +;; +;; RECREATING A PERSISTENT INSTANCE +;; +(defmethod recreate-instance-using-class ((class standard-class) &rest initargs &key &allow-other-keys) + (let ((instance (allocate-instance class))) + (apply #'recreate-instance instance initargs) + instance)) + +(defgeneric recreate-instance (instance &rest initargs &key &allow-other-keys) + (:method ((instance standard-object) &rest args &key &allow-other-keys) + (apply #'reinitialize-instance instance initargs)) + + (:method ((instance persistent) &rest args &key from-oid (sc *store-controller*)) + (initial-persistent-setup instance :from-oid from-oid :sc sc)) + + (:method ((instance persistent-object) &rest args &key from-oid) + (call-next-method) + (shared-initialize instance t :from-oid from-oid))) + hunk ./src/elephant/controller.lisp 219 - (make-instance class-name :from-oid oid :sc sc)))) + (recreate-instance-using-class (find-class class-name) :from-oid oid :sc sc)))) hunk ./src/elephant/serializer2.lisp 46 - elephant-type-deserialization-error)) + elephant-type-deserialization-error + recreate-instance-using-class)) hunk ./src/elephant/serializer2.lisp 514 - (make-instance typedesig :sc sc) + (recreate-instance-using-class (find-class typedesig) :sc sc) } Context: [Fix to from-end traversal of new map-index [EMAIL PROTECTED] [New map-index implementation [EMAIL PROTECTED] [Cheaper get-instance-by-value [EMAIL PROTECTED] [TAG ELEPHANT-0-9-1 [EMAIL PROTECTED] Patch bundle hash: a0cf91b2dc695552646e7777b7ac13887decb269
_______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel