[CDBI] objects not updated in memory

Patrik Wallstrom pawal at blipp.com
Thu Oct 27 15:42:23 BST 2005

On Wed, 26 Oct 2005, Perrin Harkins wrote:

> On Wed, 2005-10-26 at 11:30 +0200, Patrik Wallstrom wrote:
> > I have some classes which references objects which use Class::DBI,
> > more exactly, a session object which store a user object.
> Don't put Class::DBI objects in a session.  If you need to store
> something in the session, store the ID.

That is not the problem here. Btw, why should I not store (serialize?)
CDBI-objects outside of the app?

> >     my $user_id = $self->user->id;
> >     $self->{'_user'}->remove_from_object_index();
> What's that?  Is it the same as $self->user()?  This is pretty confusing
> code.

Yes, I have been moving around things in order to test them, it is the
same. user() is a method returning $self->{'_user'}.

> If you restored this User object from the session, it's not in the
> object index.

I tried everything that had to do with the object index, I know that
it's not the problem.

> > But ... even if I disable the Live object cache, I never get the
> > updated user from the database, and I can even see the query from the
> > database (and I update some records between reads).
> > 
> > Any clues on what is going on?
> My guess would be some kind of scoping problem is tricking you about
> which object you are actually looking at.  Trying to write a simple test
> case for this might help you find the problem.  Or, it could be
> something to do with isolation levels in your database and visibility of
> committed data.  What database are you using?

MySQL 5.0.15. It might be the isolation level, which is quite
disturbing if it is. I must test this right now...

patrik_wallstrom->foodfight->pawal at blipp.com->+46-733173956

More information about the ClassDBI mailing list