Google Groups Home
Help | Sign in
Hibernate + GWT: OpenSessionInViewFilter or DTO (view model objects)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Rebornspirit  
View profile  
 More options Feb 8 2007, 9:31 am
From: "Rebornspirit" <maarten.vold...@gmail.com>
Date: Thu, 08 Feb 2007 06:31:21 -0800
Local: Thurs, Feb 8 2007 9:31 am
Subject: Hibernate + GWT: OpenSessionInViewFilter or DTO (view model objects)
I would like to hear some advice on best practices.

Which one would you recommend:
- Hibernate integration with a OpenSessionInViewFilter?
- Or a GWT remote service which actually creates DTO's - meaning model
objects for a certain widget - out of multiple Hibernate instrumented
domain objects?

I prefer the second one because:
- there is a cleaner separation between the different layers
- no hibernate dependency on the view layer, which makes it easier to
switch to jdbc or something else. Because with option one you gotta
deal with the LazyInitException
- less traffic, you only send to the client exactly what he needs, in
the correct format
- ...

I would like to hear your thoughts...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Rob Jellinghaus  
View profile  
 More options Feb 8 2007, 7:59 pm
From: "Rob Jellinghaus" <rjellingh...@gmail.com>
Date: Thu, 08 Feb 2007 16:59:18 -0800
Local: Thurs, Feb 8 2007 7:59 pm
Subject: Re: Hibernate + GWT: OpenSessionInViewFilter or DTO (view model objects)
A plain OpenSessionInViewFilter won't work because GWT RPC will try to
serialize every lazy collection in your persistent object graph.

There are a couple of solutions.  You could have a separate DTO
hierarchy.  Or, you could have code that just creates copies of your
domain objects themselves, terminating lazy collections with nulls
instead -- basically an "object marshaling layer" that makes a
subsetted copy of your object graph.  (This is good if you have no
control over your serialization layer; we're doing this with Axis 1.4
in another project now.)

Or, you can hook into GWT's RPC.  See this thread -- http://
groups.google.com/group/Google-Web-Toolkit-Contributors/browse_thread/
thread/669e3d31b60bb1be -- for an example of that.

Cheers!
Rob


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google