                          (jdbc-load-childs-cache db dataset parent-collection child-collection)))
           cached (use-cache childs-cache key-fn load-cache)]
       (cached dataset parent-collection parent-id child-collection)))
+  (parent [_ dataset collection id]
+    (let [key-fn (fn [dataset collection id] [dataset collection id])
+          load-cache (fn [dataset collection _]
+                       (when (parent-load-cache? dataset collection)
+                         (jdbc-load-parent-cache db dataset collection)))
+          cached (use-cache parent-cache key-fn load-cache)
+          q-result (cached dataset collection id)]
+      (if (some #(= nil %) q-result)
+        nil
+        q-result)))
   (close [this]
     (flush-batch stream-batch (partial jdbc-insert db))
     (flush-batch link-batch (partial jdbc-create-stream db))

    (-> (jdbc-last-stream-validity-and-action db dataset collection id) second))
  (childs [_ dataset parent-collection parent-id child-collection]
    (jdbc-get-childs db dataset parent-collection parent-id child-collection))
  (close [this] this)
  )


  (current-validity [this dataset collection id])
  (last-action [this dataset collection id])
  (childs [this dataset parent-collection parent-id child-collection])
  (parent [this dataset collection id] "Returns [collection id] tuple or nil")
  (close [_])
  )

(defn path [persistence dataset collection id]
  "Returns sequence of [collection id] tuples. Parents first. Root only means empty sequence"
  (when (and dataset collection id)
    (if-let [[parent-collection parent-id] (parent persistence dataset collection id)]
      (loop [path (list)
             pc  parent-collection
             pid parent-id]
        (if-let [[new-pc new-pid] (parent persistence dataset pc pid)]
          (recur (conj path [new-pc new-pid]) new-pc new-pid)
          path))
      (list))))

(defn root [persistence dataset collection id]
  "Return [collection id] tuple with self if no other root"
  (let [path (path persistence dataset collection id)]
    (if (empty? path)
      [collection id]
      (first path))))

(def ^:dynamic *jdbc-schema* :featured)
(def ^:dynamic *jdbc-features* :feature)
