I am missing something like load/save methods on uow. I will try to bring this discussion via separate threads with usecases.
your proposed load() is probably what merge() does in JPA. Or should load be allowed only on empty uow ? - Tibor On Fri, May 18, 2012 at 5:10 AM, Niclas Hedhman <[email protected]> wrote: > On Fri, May 18, 2012 at 6:33 AM, Tibor Mlynarik > <[email protected]> wrote: >> I think that value serialization should have different schematics than >> entities. >> To serialize entity one should be able to specify graph depth, >> similarly as fetch plan. Cycles should be supported and repeated >> entities should be serialized by internal refs. > > I think "Fetch plan" is a leaking SQL abstraction, and doesn't belong. > > So the current behavior of ValueComposites are simple and straight > forward; An Association is to a Entity, referenced by Identity and if > traversed the current UoW will be used to retrieve it. > Now, that is very easy to describe (and to make work). > > You are suggesting (I think), that if we introduce Entity->Value (via > JSON or not), that the Association is automatically traversed and that > the internal Identity reference is replaced with the serialized (or > Value of) referenced entity. And as most of us knows, the "depth" > becomes an issue, as do circular references and possibly many other > edge cases. > > Another possible solution, which may be conceptually simpler, is to introduce > save(OutputStream out); > load( InputStream in ); > on UnitOfWork. > > The "depth" and circular references issues goes away; The client code > is responsible to traverse the needed graph, which loads the entities > in the UoW, and can easily be serialized. If an Association is > traversed after the UoW has been loaded on client side, but doesn't > exist, then simply a EntityNotFoundException will be thrown. Easy to > explain, easy to document, and relatively easy to implement with no > new concepts introduced. _______________________________________________ qi4j-dev mailing list [email protected] http://lists.ops4j.org/mailman/listinfo/qi4j-dev

