Yee,
Very interesting. This ties in to some discussion on this list from a
couple of weeks ago.
My impression of the "binding directly into domain models" pattern has
always been that it is great for stand-alone web-applications that you want
to get completed as fast as possible and don't care about having a strict 3
tier design.
If you need 3 tiers, then I agree that binding into domain models isn't the
best way to go. I'm using all the same basic technologies you are (stripes,
spring hibernate) but I don't allow the web tier to modify model/entity
objects directly. I do this using the low-tech method of package level
visibility on setters, mutators & business logic methods on my entities. I
do still return model objects directly to the web-tier to support OSIV, lazy
loading..etc but the web-tier has read-only access. This particular setup no
doubt seem like a hack-job to some but for us it has been the right balance
of practicality and purity :) I certainly never realized it at the time,
but it also protects me from this issue you described since no entity
objects can be modified in the web-tier outside of a transaction.
My particular application doesn't have a need for very complex structures to
be passed from the web-tier to the service tier but where it does, I just
create DTOs and uses stripes to bind them. The good news is that stripes
still helps out a great deal in this area.
On Tue, Jun 23, 2009 at 5:38 AM, CN Yee <[email protected]> wrote:
> CN Yee <yeec...@...> writes:
>
> >
> > I just confirmed that the problem lies with hibernate.
> >
> > The following code will persist everything in the session to database.
> >
> > Session s = sessionFactory.getCurrentSession();
> > Transaction tx = s.beginTransaction();
> > tx.commit();
> >
> > That is very nasty. Anybody has any experience to share regarding this?
> >
> > Regards,
> > Yee
> >
> I found the following;
>
> "With hibernate it is important to understand what exactly is going on
> under the
> covers. At every commit boundary it will attempt to flush all changes to
> objects
> in the current session regardless of whether or not the changes where made
> in
> the current transaction or any transaction at all for that matter."
>
> http://stackoverflow.com/questions/244381/hibernate-transaction-problem
>
> I think this pretty confirms that binding to domain model pattern is indeed
> not
> tenable for 3 tier architecture.
>
> Regards,
> Yee
>
>
>
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge
> conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
> $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
>
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Ross Sargant
Software Engineer
p: 954-623-6018 x2108
email: [email protected]
TVR Communications LLC
541 S. State Road 7,Suite 5,Margate, Florida,33068
http://www.tvrc.com
------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users