i would think you didnt like add() but liked import(). what does the
name "update()" mean ? to me that means you want to issue an UPDATE
statement. but SA will not issue any UPDATE statements unless the
object is modified in some way. then you might say delete() on it
and then its not getting "updated" either. to me, the method means,
"this is an object I loaded from some other Session and now I want it
to be in this Session", thats why I like "import"...it implies youre
"taking it from somewhere else and putting it here". it doesnt mean
an UPDATE is going to happen. maybe in hibernate it does, but its
different here.
also the ambiguity of addOrUpdate is, what if I create an object,
populate its primary key values, and then say "addOrUpdate" ? it has
no _instance_key. should it be treated as a new instance to be
INSERTed ? or should it get a new _instance_key corresponding to the
primary key values and be UPDATED? if you call add(), its
definitely an INSERT, and if you call import_(), it creates the
_instance_key and then its definitely an UPDATE (i.e. no
_instance_key is needed to start with)....i suppose the addOrUpdate
method not a big deal but my "explicit better than implicit" nerve is
twitching on that one....
On Apr 20, 2006, at 10:37 PM, Daniel Miller wrote:
One thing that Hibernate enforces is that a given instance is not
associated with more than one Session at any given point in time.
Although that can sometimes be a pain, I think it solves a bunch of
problems with having a single object inserted/updated by multiple
sessions. How does SA handle this?
it would be pretty impossible for an object to be in more than one
session, considering the heavy reliance upon the get_session(obj)
function. the import_ method moves it out of the other Session and
i think add() currently raises an exception if its somewhere else
already.
-------------------------------------------------------
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