guillaumeoriol/serquant — Issue #21: infinite loop in cyclic references
Author: guillaumeoriol
Created: 2012-02-28 14:46:30+00:00
State: open
Labels: defect

Say we have a *Person* entity with the following properties:

- id
- name
- permissions: Permission [*]

and a *Permission* entity with the following properties:

- person: Person [1]
- resource
- privilege

At the moment, `Persister#loadEntity` does the following:

1. try to get the entity from the map and return it if present, otherwise:
1. call `Table#loadEntity` to load the domain object
1. put this domain object into the map

With the example above, when a person is retrieved, `Table#loadEntity` of that person will, in turn, retrieve the related permissions.
Each permission will be loaded and, to do so, it will try to load the related person. It should retrieve the person from the map (as it is the already retrieved person) but won't as the domain object will be put into the map at the end of the process.