On 7/10/06, Michael Bayer <[EMAIL PROTECTED]> wrote:
we're emulating hibernate; thats even though merge() isnt really
completed (i.e. doesnt actually "merge" changes in yet....).  so
heres what hibernate has to say on this:

"Use update() if you are sure that the session does not contain an
already persistent instance with the same identifier, and merge() if
you want to merge your modifications at any time without
consideration of the state of the session. In other words, update()
is usually the first method you would call in a fresh session,
ensuring that reattachment of your detached instances is the first
operation that is executed."

so yah you probably want to stick with the update() operation on this
one.

Thanks. Things seem generally to be working now. I'm glad it wasn't a bug.

I am having one other problem that I've fixed, but I wanted to check that by you: When I pickle an object I first expunge it. Often I just got that object from the db.

u = session.get(User, 1)
session.expunge(u)
cache(u)
session.update(u)

That code causes u to not exist in the session's identity map.

u = session.get(User, 1)
cache(u)

This seems to work fine though. So, is expunge even necessary? From the docs it sounded like I should first expunge the object from the session before pickling it.

-Michael

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to