当我尝试使用字符串 tempid 针对无数据 v0.9.5656 处理此实体时,出现以下异常:
(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
文档显示我应该能够使用字符串作为临时 ID。我是否缺少一个读取器宏来告诉它有关分区的信息?
最佳答案
原来我指的是 tempid
我未包含在交易中的实体。
我希望错误更清楚,例如“您指的是 tempid 'user',但此 tx 中唯一的 tempid 是:#{"other"}"然后我会立即发现错误。
关于clojure - Datomic: `:db.error/tempid-not-an-entity` tempid 仅用作交易中的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49278607/