Closed bokmann closed 10 years ago
Thanks for reporting.
Related issue: https://github.com/relevance/diametric/issues/37
I have a solution to this, but at the moment, it only works on trees. If the objects being persisted form a graph, the ID resolution after the save stack overflows. The test with Book/Author catches it.
In my app, this isn't a big deal, but I don't want to submit this as a pullup until I have a solution that marks as visited.
In fact, the above code snippet has two issues... I have a solution for trnsitive saves, but the above code example also relies on the set's '<<' method setting the parent as dirty. That appears to be a deeper problem I'll open an issue for as soon as I understand it.
I misunderstood this a bit, but the problem was fixed in the master.
Now, diametric's reference type behaves consistent to:
http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_one http://apidock.com/rails/ActiveRecord/Associations/ClassMethods/has_many
Although some methods are missing, we can use Diametric's ref types like ActiveRecord.
However, improvements are welcome. If you have better code, give us a pull request.
Right now if I do something like:
the turtle is not also saved with the terrarium... I have to create and save the turtle first.
It would be much better if saves were transitive to all new objects, and they were all part of the same datomic transaction.