Skip to content

Step #9 : Resolving Ids after transactions

mandubian edited this page Nov 15, 2012 · 2 revisions
      val idToto = DId(Partition.USER)

      val fut = transact(
        addEntity(idToto)(
          person / "name" -> "toto",
          person / "age" -> 30
        )
      ).flatMap{ tx => 

        tx.resolve(idToto).map { totoId => 
          transact(
            addEntity( DId(Partition.USER) )(
              person / "name" -> "tutu",
              person / "age" -> 54,
              person / "friend" -> totoId
            ),
            addEntity( DId(Partition.USER) )(
              person / "name" -> "tata",
              person / "age" -> 23,
              person / "friend" -> totoId
            )
          ).map{ tx => ...
          }