> > You should always create a context and then create objects within that > context using the methods Cayenne > gives you. This is different to the undecorated POJO that Hibernate allows > you to create. > > Ari >
I develop a web-app and if I will create entities bounded to a dataContext, and after user has leaved the page (by browser navigation buttons, closing the tab, etc.) such entities will stay uncommitted and may be in inconsistency state (user has not filled all required fields). And on the next commit this objects will be committed and raise validation exception. It is the reason why I want to use unbounded dataObjects. So I've decide to use transient objects not bounded to any dataContext. In this case such object just be removed by garbage collector after user leaved page unexpectedly. And where user will click OK, such objects will be manually attached to a dataContext and committed. It makes my code less clearly if can't set relationships between transient objects. Because I need to create additional temporary lists to store all transient entities and iterate its to register to a dataContext before committing. What is the best practice for this use case?
