[Helma-user] Adding objects to generic object reference in onPersist()
Kris Leite
kleite at imcsoftware.com
Tue Sep 25 08:23:19 CEST 2007
Hi Anton,
Sorry, but I didn't intend to make that a personal response. Took the
wrong option by accident.
Thanks for reposting.
-Kris
Anton Pirker wrote:
> Good Morning!
>
> I got an reply to my question from Kris Leite yesterday via direct mail.
> I just wanted to post it here to have a possible solution for others
> with the same problem.
>
> His patch works great, but i do not know how much impact it has on
> Helmas performance or other stuff i am unaware of. Could some of the
> guys knowing about the internal stuff of Helma have a look on the patch
> and give some comment?
>
> Thanks, Anton
>
> Kris wrote:
>
> > Hi Anton,
> >
> > > > I think it is because onPersist is called right before the object is
> > > > stored. So when a create a 'Change' object and add it to a
> > > > 'changes'-collection of this in onPersist this does not have an
> finale
> > > > id and so the 'Change'-Object does not know who his parent is.
>
> > I had the same idea of wanting to add a history of changes to a
> > HopObject. I also have very similar code in the onPersist to implement
> > that idea and got the same results. This issue is not Helma knowing
> > how to store it, it just ignores any additional HopObject changes
> > during the commit. I added a modification to the commit routine of
> > Transactor.java to pickup any additional HopObject changes during the
> > commit operation. The code changes are very simple, in
> > Transactor.java at lines: 260, 261 which are:
> >
> >
> > if (!dirtyNodes.isEmpty()) {
> > Object[] dirty = dirtyNodes.values().toArray();
> >
> >
> > Replace with:
> >
> > while (!dirtyNodes.isEmpty()) {
> > Object[] dirty = dirtyNodes.values().toArray();
> >
> > // reset dirty node list
> > dirtyNodes = new HashMap();
> >
> >
> > Then your onPersist code will work.
> >
> > Later,
> > Kris
>
> _______________________________________________
> Helma-user mailing list
> Helma-user at helma.org
> http://helma.org/mailman/listinfo/helma-user
>
>
More information about the Helma-user
mailing list