is the exception thrown upon deleting the object, or upon saving a
list that contains a deleted object? I can add an exception for the
latter pretty easily (probably should). The former requires that I
track all the lists every object belongs to. what is the reason
hibernate doesnt remove deleted items automatically ? i can see
below theyre expecting you to do it yourself but i wonder if the same
feature request has been made to them.
On Feb 22, 2006, at 4:17 PM, dmiller wrote:
After a bit of research, I found out that Hibernate does not do
this automatically either. However, an exception is thrown if a
child object is deleted and that object is in a list:
ObjectDeletedException: deleted object would be re-saved by cascade
(remove deleted object from associations)
The following Hibernate FAQ entries relate to this scenario:
Hibernate throws: Flush during cascade is dangerous.
This almost always happens because you forgot to remove a deleted
instance from an association with cascading save enabled. You
should remove deleted objects from associations before flushing the
session. Basically, the object you're trying to delete would be
resaved to the database by it being in a collection hanging off
another object. You need to remove it from other collections before
deleting it.
When I delete an object that belongs to a cached collection, the
collection cache is not invalidated!
You must remove the deleted object from all collections it belongs to.
I now see that there is good reason for not removing deleted items
from collections automatically. So, ignore my implicit request to
have this happen.
~ Daniel
On Feb 21, 2006, at 3:02 PM, Michael Bayer wrote:
currently its not removing deleted items from lists. if you had
an object "A" that was installed within the lists of 20 other
objects, would I maintain a backwards lookup table of all the
lists that object is present in to find them when its marked as
deleted ? i fear that may an excessive use of resources. feel
free to add an enhancement ticket, maybe this could be an
enableable option.
On Feb 21, 2006, at 2:46 PM, dmiller wrote:
Example:
>>> en = Entity(...) # SQLAlchemy entity class
>>> len(en.attrs)
2
>>> a = en.attrs[0]
>>> objectstore.delete(a)
>>> len(en.attrs) # should this return 1?
2
>>> objectstore.commit()
>>> len(en.attrs) # this should definitely return 1
2
It appears that AttributeManager is not removing deleted items
from lists.
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through
log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD
SPLUNK!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users