i dont use the osiv filter i just make sure the DAO object method returns the objects initialised correctly (i.e. all lazy collections that are to be accessed are initialised) for how its going to be used - i might have a DAO method to return the plain object with no collections initialised and one with all collections initialised or somewhere in between. this gives me full control over persistence etc... adam
> Subject: ModelDriven & Hibernate Entities > Date: Wed, 9 Mar 2011 11:34:32 -0600 > From: chris.cranf...@setech.com > To: user@struts.apache.org > > I had started down a path of using the ModelDriven interface from Struts > because I find it really helps maintain a class action class without > large numbers of get/set methods for screens that contain a lot of form > fields. > > However, I am finding at least with how I have attempted to approach > ModelDriven to have several drawbacks. For example, by using the OSIV > (Open Session In View) filter, I am finding that when Struts sets the > properties on the entity and afterward if an exception is thrown, caught > and handled and doesn't trigger Hibernate to actually "rollback"; the > changes are persisted which leaves my entity in a dirty inconsistent > state. > > How have others solved this by using your entity domain POJOs in your > view? > > Do you use them detached from the session so that you explicitly have to > merge them to the session to be persisted? If so, how do you deal with > multiple lazy loaded collections in your entity? > > Or would using DTO objects from my service layer a better alternative to > insure that no data is actually persisted to the database that shouldn't > be? > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org >