1

Our project makes use of gilead to pass model objects to the client side using the GWT RPC model. The problem we face is that serializing to and from JSON on the client side for procesing is becoming more of an issue as our model grows / changes.

I am considering using Overlay Types as our client side representation of our entity objects.

What is the general approach for this when using it in conjunction with Hibernate, do you have to recreate the objects server side and then persist ?

Would it be possible to pass the client side object back and then use Dozer to map to the server side Entity ?

Thanks, Andros

Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
Andy
  • 13
  • 2

1 Answers1

1

With Gilead and GWT-RPC, you don't need to translate your objects to JSON at all. You just pass your objects (entities which extend net.sf.gilead.pojo.gwt.LightEntity) to the client, and use them directly on the client. You can also send these objects from the client to the server. I would recommend to look at the Gilead example in this article:

http://code.google.com/webtoolkit/articles/using_gwt_with_hibernate.html

You can download the source code here:

http://google-web-toolkit.googlecode.com/files/gwt_hibernate_gilead.zip

Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
  • Thanks, but when using e.g. a SmartGWT listgrid I still have to keep serializing to JSON in my datasource to publish the data on the client. This is becoming more and more of an issue due to the complexity of the model objects i.e. lots of nested objects etc. – Andy Apr 07 '11 at 08:58
  • @Andy: In that case, maybe you can make use of [AutoBean](http://code.google.com/p/google-web-toolkit/wiki/AutoBean). I haven't used it yet (because it's not necessary for my plain GWT or even Ext-GWT applications), but AutoBean looks promising, because you can use it to auto encode/decode data model objects to/from JSON, and it can be used both on the client and server. – Chris Lercher Apr 07 '11 at 09:07
  • great suggestion. Gave it a try and it looks like this is exactly what I need. FYI I have now changed my server interaction. I now use pure JSON between client and server and then deserialize using a combination of AutoBean (and if requried use Dozer to map to a JPA entity) nice and neat. – Andy Apr 08 '11 at 10:36