Re: [CDBI] objects not updated in memory

[prev] [thread] [next] [Date index for 2005/10/26]

From: Perrin Harkins
Subject: Re: [CDBI] objects not updated in memory
Date: 14:18 on 26 Oct 2005
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.

>     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.

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

> 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?

- Perrin


_______________________________________________
ClassDBI mailing list
ClassDBI@xxxxx.xxxxxxxxxxxxxxxx.xxx
http://lists.digitalcraftsmen.net/mailman/listinfo/classdbi

[CDBI] objects not updated in memory
Patrik Wallstrom 09:30 on 26 Oct 2005

Re: [CDBI] objects not updated in memory
Perrin Harkins 14:18 on 26 Oct 2005

Re: [CDBI] objects not updated in memory
Patrik Wallstrom 14:42 on 27 Oct 2005

Fwd: [CDBI] objects not updated in memory
Phil Mitchell 16:17 on 27 Oct 2005

Re: [CDBI] objects not updated in memory
Perrin Harkins 16:47 on 27 Oct 2005

Generated at 09:28 on 02 Nov 2005 by mariachi v0.52