clojure - Datomic: `:db.error/tempid-not-an-entity` tempid 仅用作交易中的值

标签 clojure datomic

当我尝试使用字符串 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/

相关文章:

clojure - Clojure 在其他平台上的实现?

clojure - 为什么 Clojure 编译器不会因类型提示不正确而抛出错误?

clojure - Datomic 与 Neo4j 相比如何?

clojure - Datomic:不区分大小写的查询

clojure - 数据查询 : find all entities with some value

shell - Clojure 中最常见的 shell 脚本编写方式是什么?

clojure - clojure 1.3 中有哪些重大变化?

java - java有没有好的dataflow并发库

clojure - 在datomic中,如何找出哪些键可用于反向查找?

postgresql - 存储后端如何影响 Datomic?