Re: GWT and Hibernate
Another solution is to detach Hibernate proxies manually (easy), then you don't need to use a third part library or to duplicate your objects with DTO.
1. create an interface Detachable {void detach();}
2. in each entity used on client side, remove the lazy loading & add the Detachable implementation :
public void detach() {
// replace Hibernate proxies by java objects
final List<String> lstNames = new ArrayList<String>();
for (String name : this.names)
lstNames.add(name);
this.names = lstNames;
// do the same on each attribute
for (EntityChild child : childs)
child.detach();
}
3. Make a call to detach() before serialization, you can do it :
- in your code at the end of the method
- in a custom implementation of the Serializator which extends the one used by GWT
On Friday, December 16, 2011 6:20:20 AM UTC-5, big_blue wrote:
Hi.--I know there a lot of feed about GWT and Hibernate / Spring but until
now i do not find a good answer of my question.What i want to do is a simple web application with plain java POJOs
and database persistence with hibernate. AND and this is the main
part. I just want to have one java class for front an backend. Is this
possible?Maybe the shared package structure is the correct place, but there
will be some problems with the serializable functionality of the
frontend. The hibernate magic will be a problem for that. It would be
very helpfull to get some imformations or an example. Maybe an info
about the package structure of a project.THANKS
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home