Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    SmartGWT integration with Hibernate4GWT

    Hi,
    I have a project that uses Hibernate4GWT and GWT Ext and I am planning to migrate to SmartGWT. However I haven't found an example on how to configure a datasource to use the pojos that hibernate4GWT makes available in the client.
    Should I stop using hibernate4GWT and move to a more flexible architecture?
    Any advice is more than welcome.
    Cheers
    Sergio

    #2
    Hi Sergio,

    Have you examined this sample that uses RestDataSource :

    http://www.smartclient.com/smartgwt/...ured_restfulds

    A couple of things worth noting are :

    1. The response to the FETCH request contains information on the totalRows, startRows and endRows in addition to the "bean" data. This is required for grid virtual scrolling.

    2. The protocol for passing back update's / delete's is very clean with RestDataSource. Examine the data files in the above samples. For updates, the primary key, along with only the fields that have been updated, with new value are passed to the server. And for deletes, the primary key value is passed to the server. So this makes is very easy for the server to understand which operations to carry out, and precisely what bean members to update.

    Hibernate4GWT is neat, and we'll look into ways we can incorporate it in a future release, however as mentioned above, passing subsets of the model beans to the client via this mechanism is just a partial solution and makes updates to the beans on the server difficult to manage. Updating the entire object passed from the client, which again may not represent the entire object with its associations, is a common problem today as you may end up with an incomplete object update since not all data was sent to the client.

    You can fairly easily setup a controller layer that, say, uses Spring and uses XStream to convert your beans to XML for FETCH requests, and similarly process update and delete requests. With this approach you also have finer grain control of how much data from your model bean you want to send to the client for a particular screen as opposed to all the data / members of the bean (besides lazy associations) that a Hibernate4GWT solution might yield.
    Last edited by smartgwt.dev; 19 Nov 2008, 11:07.

    Comment


      #3
      Thanks for that, very much appreciated. I will have a look to that approach. Or maybe now it is time to learn some Ruby...
      Cheers
      Sergio

      Comment


        #4
        If I read correctly, do you mean we are no longer using hibernate4gwt in SmartGWT?

        Comment


          #5
          i am working on moving some projects over that use hibernate4gwt as well. If the process i am using works i'll be more than happy to share with you.

          regards,

          jason

          Comment


            #6
            Thanks for that Jason, that would be great.
            Cheers
            Sergio

            Comment


              #7
              I'm also looking forward to your integration guide if you succeed.

              regards,

              huage

              Comment


                #8
                sorry, i posted a reply to this on the google board.
                i was able to get h4gwt working with smartgwt, but after reading sanjiv blog on the smartclient datasource i wanted to give it a try to compare the two systems.

                i have a few things to get done this week, but will post the h4gwt when i have more time.

                Comment


                  #9
                  ok - sorry for the delay in responding. i was able to get hibernate4gwt and smartgwt working with a little refactoring. since that time hibernate4gwt has moved into GILEAD and works the same way.

                  however, after working with this and having a better understanding of how smartgwt works. i have decided upon using the following system.

                  1 - smartgwt
                  2 - gwt-sl
                  3 - spring
                  4 - hibernate

                  i have found that hibernate4gwt/gilead performs as advertised for passing objects, but i believe it forces you down a path that is not needed to achieve the goals of presenting data in smartgwt.

                  the path i have started to use and find works well is using a standard server-side setup of spring/hibernate and using a session based conversation context that is converted to xml. this xml file is then passed to the smartgwt layer.

                  all the widgets in smartgwt can read/write xml data via the datasource class. i believe after coding up 4 separate systems using both techniques that this is the cleanest and fastest implementation.

                  Comment


                    #10
                    It would be great if you put a working sample/small casestudy of how you have integrated SmartGWT+Spring+Hibernate+(any database)!! I have been able to achieve SmartGWT+RPC+MySql but getting more difficulties in achieving the SmartGWT+Spring+Hibernate capability.

                    I m using Pro version of Smartclient.
                    Thanks,

                    Comment

                    Working...
                    X