I'm trying to use Java interop
but I'm kinda newbie hahha
(defn create
"Takes a map of keyword-value pairs and puts a new Entity in the Datastore.
The map must include a :kind String.
Returns the saved Entity converted with entity-to-map (which will include the assigned :key)."
([item] (create item nil))
([item #^Key parent-key]
(def key (.allocateId dataStore (.newKey keyFac)))
(let [kind (item :kind)
properties (dissoc item :kind)
entity (Entity/newBuilder key)]
(doseq [[prop-name value] properties] (.set entity (name prop-name) value))
(.getId (.getKey (.add dataStore (.build entity)))))))
I'm having problem with this
I'm trying to take a map from a jdbc query into a ms-sql db and inserting the data into datastore