ToManyMapping saving instances twice

5 views
Skip to first unread message

Esteban A. Maringolo

unread,
May 18, 2014, 7:36:17 PM5/18/14
to glorp...@googlegroups.com
I'm importing a lot of objects from a plain text file, and for some reason I don't understand I'm getting the #items item of my parent object inserted twice.

I have the class Route that has many RouteItems.  

The importer code got somewhat convoluted, but basically what it does is:

glorpSession inUnitOfWorkDo: [:session |
       [ stream atEnd ] whileFalse: [
              route := Route new.
              session register: route
              route addItem: RouteItem new.
       ]      
].

If I run a simplified version of the above code, it works ok. So the mappings are fine.

Something like:

glorpSession inUnitOfWorkDo: [ :session |
| route |
route := Route new.
session register: route.
route addItem: RouteItem new.
session register: route.
route := Route new.
session register: route.
route  addItem: RouteItem new.
]


I can't understand what is causing the duplication of inserts in my "real" code.

Any clues?


Best regards,








Esteban A. Maringolo

unread,
May 18, 2014, 8:15:43 PM5/18/14
to glorp...@googlegroups.com
Nevermind... it was my mistake.


http://i.imgur.com/nvHCfC8.gif?1
Esteban A. Maringolo
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "glorp-group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/glorp-group/TxBRpfcur5k/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> glorp-group...@googlegroups.com.
> To post to this group, send email to glorp...@googlegroups.com.
> Visit this group at http://groups.google.com/group/glorp-group.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages