When I try to transact this entity using a string tempid against datomic-free v0.9.5656, I get the following exception:
(def tx1 {:db/id "user"
:contact/full-name "John Wayne"})
(def tx2 {:db/id "other"
:some-ref "user"
(let [!rx (d/transact conn [tx2])]
(prn (:tempids @!rx))
=>
datomic.impl.Exceptions$IllegalArgumentExceptionInfo: :db.error/tempid-not-an-entity tempid used only as value in transaction
data: {#object[clojure.lang.Keyword 0x74af59e7 ":db/error"] #object[clojure.lang.Keyword 0x57972b49 ":db.error/tempid-not-an-entity"]}
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: :db.error/tempid-not-an-entity tempid used only as value in transaction
The documentation shows I should be able to use strings as tempids. Am I missing a reader macro to tell it about a partition?
Turns out I was referring to a tempid
of an entity that I was not included in the transaction.
I wish the error was clearer, e.g. "You refer to tempid 'user', but the only tempids in this tx are: #{"other"}" And then I'd spot the error immediately.
Another way to get this error message is if you set an attribute to an empty vector. Presumably []
is being interpreted as a tempid, and there's no corresponding :db/id []
to be found in the transaction.
Similar reasoning for an empty map {}
- where's the tempid in the transaction with value {}
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With