The core of the issue is you are not using an identity map (and I'm not sure an identity map would handle one-to-many or many-to-many situations).
Without an identity map, when you have two objects in memory that represent the same object in the DB, and one of those objects changes the DB, the other object is unaware. You must reload the other object to get changes from the DB. The reason size and count are performing differently is size does the size of the children array (either grabs the children or assumes the current cache for the object is up-to-date), and count performs a SQL query that has the DB count the children, so the children data does not need to be sent, just the final answer. -- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.