Hi Iain, I might be misunderstanding you, but it sounds like you have a graph of transient objects. If a transient object is persisted, then it will automatically walk the graph and persist all other objects - "persistence by reachability". This might be the reason why your other transient object is then encountering the "already persisted" error when it in turn attempts to persist itself.
Or... maybe you just need to use the DomainObjectContainer#persistIfNotAlready(Object) rather than DomainObjectContainer#persist(Object). If neither of these suggestions help, could you post some code here and we'll try to help out. Thx Dan On 14 June 2011 16:58, Iain Flynn <[email protected]> wrote: > Hi, so I've started using Isis for my MSc project. I'm currently writing a > simple application, but I've hit a rather large snag. > > I have a couple of classes that have a containment relationship with other > classes. I use a reference to the contained object and only allow instances > of the contained to be created by the container - this works fine. > > However, if I have a class that refers to another domain class that can be > created independently, I get an 'object already persisted' error. I can't > see what is different about the two cases - I have a newWhatever method > implemented in their repositories, where they are persisted (I haven't set > up a bi-directional relationship) using the persist() method. > > I get the feeling that I'm missing something very simple here, and any help > would be greatly appreciated. > > Thank you for reading, > > - Iain.
