Hello Michael.
Your change saves the application to crash but it doesn't give back the
object.
Attached I have a diff for an extended test.
Jürgen
And sorry for the bad subject :(
Michael Bayer wrote:
> this is a known issue in ticket 185; youd have to call get([employee_id,
> employee_id]). I have just committed a very small hack in 1508 that
> will work around this, though (by making an assumption about the given
> id), so give that a try.
>
>
> On May 25, 2006, at 8:28 AM, jürgen Kartnaller wrote:
>
>> employee_id = c.employees[0].person_id
>>
>> + employee_cls = c.employees[0].__class__
>>
>> +
>>
>> + session.flush()
>>
>> + session.clear()
>>
>> +
>>
>> + e = session.query(Person).get(employee_id)
>>
>> + e = session.query(employee_cls).get(employee_id)
>>
>> +
>>
>> + c = session.query(Company).get(id)
>>
>> +
>>
>
--
---------------------------------------------------
Jürgen Kartnaller mailto:juergen_at_kartnaller.at
http://www.kartnaller.at
http://www.mcb-bregenz.at
---------------------------------------------------
Index: polymorph.py
===================================================================
--- polymorph.py (Revision 1509)
+++ polymorph.py (Arbeitskopie)
@@ -161,6 +161,19 @@
for e in c.employees:
print e, e._instance_key
+ employee_id = c.employees[0].person_id
+ employee_cls = c.employees[0].__class__
+
+ session.flush()
+ session.clear()
+
+ e = session.query(Person).get(employee_id)
+ assert e is not None
+ e = session.query(employee_cls).get(employee_id)
+ assert e is not None
+
+ c = session.query(Company).get(id)
+
session.delete(c)
session.flush()