Datomic:`:db.error/tempid-not-an-entity` tempid仅用作事务中的值

Pet*_*ron 4 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
Run Code Online (Sandbox Code Playgroud)

文档显示我应该能够使用字符串作为tempid.我错过了一个读取器宏来告诉它一个分区吗?

Pet*_*ron 11

事实证明,我指的tempid是一个我没有被包含在交易中的实体.

我希望错误更清楚,例如"你引用tempid'用户',但是这个tx中唯一的时间是:#{"other"}"然后我会立即发现错误.

  • 2018年12月22日:再次被钉住了。 (3认同)