Esteban,

That's totally fine for me. I've been doing explicit saves in ORMs since
more than a decade. I can live with that.

My question was to have more than one class of element in the same
collection mapping.

Regards!


Esteban A. Maringolo


2013/9/10 Esteban Lorenzano <[email protected]>

> Hi,
>
> I just found some time to see this... there is a problem with
> saving/updating circular references that I "solved" by not solve it at all
> :(
> here is the thing:
>
> when you create a new group and add a new user, the #save message will
> find the new objects (in this case group and user) and save both.
> Now, when you are updating, I do not have any way (so far), to know which
> part of the graph is actually updated and needs to be saved (and we all
> will agree that persisting each time all structure will not be efficient).
> So I just do not do it, I'm sorry :(
> That mean that if the referenced object is not new,  it is not stored...
> just the "first level" object is...
>
> I know is not a good solution, but what I do is to save each element of
> the graph separated:
>
> user := User new save.
> group := Group new
>         add: user;
>         save.
>
> so, taking each updated element as a unity will do the job.
>
> I know, I know... this is not optimal (and in fact is pretty bad), but
> well... is what I could do at the moment and never had the time to enhance
> it.
>
> Esteban
>
>
> On Aug 30, 2013, at 3:12 AM, Esteban A. Maringolo <[email protected]>
> wrote:
>
> > Hi all,
> >
> > Let's say I have a class Group and a class Member.
> >
> > aGroup has many members.
> > and aMember can belong to many groups.
> >
> > What is the "proper" voyageDescription for those one to many relations?
> >
> > Should I do something extra?
> >
> > Everytime I add a member to the group, both the member and the group
> > get their references updated.
> > Now when I add a member to a group and save it, I also save the
> > member. Is there another way to avoid this?
> >
> > Any recommended practice for this?
> >
> > Next level question: What if it gets composite? it is... a Group has
> > other Groups as members :)
> >
> >
> > Regards!
> >
> > Esteban A. Maringolo
> >
>
>
>

Reply via email to