I am new to Cayenne but enjoying using it, I have a question about what to do with new or modified objects when a validation failure or runtime exception happens on Commit.
This is my Environment TomCat 5.0 Java 1.4.2 Cayenne 2.0.4 Struts For example in my save new painting Actionclass DataContext context=context.getgetThreadDataContext(); //Get artist object Artist a= (Artist)DataObjectUtils.objectForPK(context,State.class, 1); Painting p = (Painting)context.newObject(Painting.class); //Fill in painting from Form post (I use Dozer) . . p.setToArtist(a); try { context.commit(); } catch (Exception e) { //What to do here ??? } What do I do when there is an exception, (unregisterobjects?) I do not want the modified Artist and the new Painting sitting on the context. Because Cayenne would try to commit them if the user went to the gallery screen now and changed a Gallery. Should I not use the threadDataContext in a web app and create a new data context for each save page to avoid this problem. What is the convention for a web/struts app. I am sure many people have encountered and solved this before me. Thanks in advance, DB