Methods and systems for recursive saving of hierarchical objects to a database
First Claim
Patent Images
1. A method for recursively saving an inserted or updated object that is part of a hierarchy to a database, the method comprising:
- receiving a value for a first record in a database;
determining that a parent record of the first record has a field that is dependent on the received value;
recursively determining that a grandparent record of the first record has a field that is dependent on the received value;
loading the first record from the database into a first object;
updating, using a processor operatively coupled to a memory, the first object with the received value;
flushing the updated first object to the first record in the database;
loading the parent record from the database into a second object;
updating the second object based on the received value;
flushing the updated second object to the parent record in the database;
recursively loading the grandparent record from the database into a third object;
recursively updating the third object based on the received value;
recursively flushing the updated third object to the grandparent record in the database;
wherein the method further comprises;
detecting a fault in processing a set of records of the database, wherein at least one of the records includes at least one side effect;
rolling back each of the records processed including the first record and retrying processing on a subset of the set of records in which records associated with faults have been removed until a subset of the set of records in which each record of the subset of records is configured to be processed to the database without fault is determined; and
processing the subset of records to the database and executing the at least one side effect, thereby ensuring that no side effects have occurred from executing code on behalf of any records associated with a fault.
1 Assignment
0 Petitions
Accused Products
Abstract
Methods and systems include embodiments that recursively save parent, grandparent, and other records in a database that depend from a record. User-provided code within a save event or trigger can thus call further save methods without corrupting the database. Junction objects, objects that reflect records with two or more parents, can also be recursively saved.
-
Citations
20 Claims
-
1. A method for recursively saving an inserted or updated object that is part of a hierarchy to a database, the method comprising:
-
receiving a value for a first record in a database; determining that a parent record of the first record has a field that is dependent on the received value; recursively determining that a grandparent record of the first record has a field that is dependent on the received value; loading the first record from the database into a first object; updating, using a processor operatively coupled to a memory, the first object with the received value; flushing the updated first object to the first record in the database; loading the parent record from the database into a second object; updating the second object based on the received value; flushing the updated second object to the parent record in the database; recursively loading the grandparent record from the database into a third object; recursively updating the third object based on the received value; recursively flushing the updated third object to the grandparent record in the database; wherein the method further comprises; detecting a fault in processing a set of records of the database, wherein at least one of the records includes at least one side effect; rolling back each of the records processed including the first record and retrying processing on a subset of the set of records in which records associated with faults have been removed until a subset of the set of records in which each record of the subset of records is configured to be processed to the database without fault is determined; and processing the subset of records to the database and executing the at least one side effect, thereby ensuring that no side effects have occurred from executing code on behalf of any records associated with a fault. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10)
-
-
11. A non-transitory machine-readable storage medium having instructions stored thereon for recursively saving an inserted or updated object that is part of a hierarchy to a database, that, when executed by one or more processors, the instructions cause the one or more processors to perform operations comprising:
-
receiving a value for a first record in a database; determining that a parent record of the first record has a field that is dependent on the received value; recursively determining that a grandparent record of the first record has a field that is dependent on the received value; loading the first record from the database into a first object; updating, using a processor operatively coupled to a memory, the first object with the received value; flushing the updated first object to the first record in the database; loading the parent record from the database into a second object; updating the second object based on the received value; flushing the updated second object to the parent record in the database; recursively loading the grandparent record from the database into a third object; recursively updating the third object based on the received value; recursively flushing the updated third object to the grandparent record in the database; wherein the instructions cause the one or more processors to perform operations further comprising; detecting a fault in processing a set of records of the database, wherein at least one of the records includes at least one side effect; rolling back each of the records processed including the first record and retrying processing on a subset of the set of records in which records associated with faults have been removed until a subset of the set of records in which each record of the subset of records is configured to be processed to the database without fault is determined; and processing the subset of records to the database and executing the at least one side effect, thereby ensuring that no side effects have occurred from executing code on behalf of any records associated with a fault.
-
-
12. A method for recursively deleting a record that is part of a hierarchy in a database, the method comprising:
-
receiving an instruction to delete a first record in a database; determining that a parent record of the first record has a field that is dependent on the first record; recursively determining that a grandparent record of the first record has a field that is dependent on the first record; loading the first record from the database into a first object; deleting the first record in the database; loading the parent record from the database into a second object; updating, using a processor operatively coupled to a memory, the second object based upon the deletion of the first record; flushing the updated second object to the parent record in the database; recursively loading the grandparent record from the database into a third object; recursively updating the third object based on the deletion of the first record; recursively flushing the updated third object to the grandparent record in the database; wherein the method further comprises; detecting a fault in processing the deleting of a set of records of the database, wherein at least one of the records includes at least one side effect; rolling back each deleting of the set of records processed including the first record and retrying processing the deleting on a subset of the set of records in which records associated with faults have their deletion rolled back until a subset of the set of records in which each record of the subset of records is configured to be processed to the database without fault is determined; and processing the deleting of the subset of records to the database and executing the at least one side effect, thereby ensuring that no side effects have occurred from executing code on behalf of any records associated with a fault. - View Dependent Claims (13, 14, 15, 16, 17, 18, 19)
-
-
20. A non-transitory machine-readable storage medium having instructions stored thereon for recursively deleting a record that is part of a hierarchy in a database that, when executed by one or more processors, the instructions cause the one or more processors to perform operations comprising:
-
receiving an instruction to delete a first record in a database; determining that a parent record of the first record has a field that is dependent on the first record; recursively determining that a grandparent record of the first record has a field that is dependent on the first record; loading the first record from the database into a first object; deleting the first record in the database; loading the parent record from the database into a second object; updating, using a processor operatively coupled to a memory, the second object based upon the deletion of the first record; flushing the updated second object to the parent record in the database; recursively loading the grandparent record from the database into a third object; recursively updating the third object based on the deletion of the first record; recursively flushing the updated third object to the grandparent record in the database; wherein the instructions cause the one or more processors to perform operations further comprising; detecting a fault in processing the deleting of a set of records of the database, wherein at least one of the records includes at least one side effect; rolling back each deleting of the set of records processed including the first record and retrying processing the deleting on a subset of the set of records in which records associated with faults have their deletion rolled back until a subset of the set of records in which each record of the subset of records is configured to be processed to the database without fault is determined; and processing the deleting of the subset of records to the database and executing the at least one side effect, thereby ensuring that no side effects have occurred from executing code on behalf of any records associated with a fault.
-
Specification