1) Configured Oracle sequences for primary key generation. See data-map.dtd, org.objectstyle.cayenne.map.DbEntity.java, org.objectstyle.cayenne.dba.oracle.*, MapLoader.java, etc. 2) Modification of the data context commit algorithm to correctly resolve the following dependencies: * Primary key generation dependencies - for newly created objects to insert the order in which their primary key values are generated must be such that if for any two objects 'a' and 'b' of ObjEntities 'A' and 'B' primary key of 'A' depends on an attribute of 'B' (toDependentKey for the corresponding DbEntities in the data map) then the primary key value of 'b' must be generated before the one of 'a' is. This is accomplished by implementing the topological sorting algorithm on the acyclic digraph representing such dependencies. See net.ash.graph.* and org.objectstyle.cayenne.access.PrimaryKeyGeneration.java * Referential integrity dependencies - for any two objects to insert (delete) the one referenced by a foreign key of the other must be inserted into (deleted from) the table first (second). The implemented algorithm is guaranteed to succeed for database schemas without referential loops (a table references itself) and cycles (table A -> table B -> table C -> table A, and likes), and even in the case of presence of such loops and cycles the algorithm will do its best to successfully resolve the graph of objects to insert (delete), the insertion success not guaranteed though. The algorithm works as follows - using the DbEntities serviced by the data node in question and based on the referential metadata retrieved from the database the digraph of the referential integrity dependencies with the tables as vertices is built. Then all the strongly connected components are identified and new digraph is built by contraction of the first one. The principle of the contraction is - a vertex in the contacted digraph corresponds to a strongly connected component in the original digraph and two vertices in the contracted digraph are connected by an arc with the first vertex as an origin and the second one as a destination if and only if there are arcs in the original digraph such that their origins belong to the component mapped to the first vertex and destinations belong to the component mapped to the second one. It can be easily proved the digraph obtained by the contraction is acyclic and does not contain any loops. The in-degree topological sorting algorithm supplies us with the order of the strongly connected components used to sort the objects to insert. The reversed order is utilized to sort the objects to delete. See details in net.ash.graph.*, net.ash.dbutil.*, org.objectstyle.cayenne.access.RefIntegritySupport.java, org.objectstyle.cayenne.access.ContextCommit.java, etc.