Announcement

Collapse
No announcement yet.
This is a sticky topic.
X
X
  • Filter
  • Time
Clear All
new posts

    #76
    SmartGWT vs SmartGWTEE version

    Dear,

    I'm evaluating the SmartGWTEE version for our project, but I'm facing a problem regarding versions between SmartGWT and SmartGWTEE.

    My problem is that I’m using a ListGrid with the summary features (summary function,...), which are available with SmartGWT but not with SmartGWTEE....

    I'm using :
    * SmartGWTEE v1.2.1
    * SmartGWT v1.3
    * Gwt 1.7.1
    * Platform : Mac OS X v10.6.1
    * Server : Apache Tomcat 6.0.20

    If I declare:
    Code:
    <inherits name="com.smartgwtee.SmartGwtEENoScript"/>
    then, no errors, but my listgrid do not use any summary features.
    If I only declare :
    Code:
    <inherits name="com.smartgwt.SmartGwtNoScript"/>
    then, when the server is starting, I get errors like :
    Code:
    java.io.FileNotFoundException: /Developer/DevArea/ilem-Workspace/ilemErp/ilemERP/erp/erp-client/war/ilemErp/sc/system/schema/builtinTypes.xml (No such file or directory)
    and …
    Code:
    java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.util.Map
    Then, is there a way to get SmartGWTEE version 1.2.1, and SmartGWT 1.3 running together ?
    Otherwise, do you have a relase date for SmartGWTEE to be at the same level then SmartGWT ?

    With my best regards.

    Alexandre

    Comment


      #77
      example for using Hibernate with annotations

      Dear Isomorphic,

      we are about to decide the persistence strategy (and client-server communication system) for a new project, and we are evaluating SmartGWT EE.

      When defining the domain model, we would like to avoid having to repeat the definition of the fields over and over again, so we are looking for a way to specify the objects the just once.

      Is it possible to use Hibernate with annotations together with the Hibernate connector of SmartGWT EE? (If yes, where can I find a working example for this?)

      We would like to specify the domain object in the java code (POJOs), annotate them for hibernate/JPA (whichever works), and automatically generate both the database schemas and the smartgwt datasources from this metadata.

      Is this possible? What tools do we need to use? How much of this process is automated?

      * * *

      If we are on the wrong track, could you please suggest us an approach to reach our stated goal? (Which would be to have only a single point in the application which contains the model definition, and no further hand-written hbm or persistence or datasource xml files to modify when something changes.)

      Comment


        #78
        @csillag You're on the right track and definitely thinking about the problem the right way.

        Given a bean you've created and registered with Hibernate you can use the Hibernate Bean wizard in the Visual Builder to generate a DataSource .ds.xml file from it. Here's one user explaining the process.

        SmartGWT doesn't need to specifically look at SQL-related annotations because it won't need them when using the Hibernate connector to access Hibernate.

        That said, there are annotations (SQL and otherwise) that could be used to make the generated .ds.xml file richer, for example, cause various validators to be added automatically (such as lengthRange for a text field). We provide a general solution for this with the Batch DataSource Generator, where you have the source code for how we generate the .ds.xml file from the bean, and can add code to pick up standard annotations or your own custom annotations to create a richer generated .ds.xml, so you can drive as much behavior as possible from your Java Bean.

        Samples of how to detect and use Annotations to generate a better DataSource can be found in tools/batchDSGenerator.jsp (along with a lot of comments about the tool and how it's meant to be used).

        Undoubtedly there are standard Hibernate/JPA annotations that the Batch DataSource Generator could be enhanced to use automatically, and there's the possibility of special SmartGWT-specific annotations that could be defined to allow more behavior to be driven by annotations. If you run into anything that you think should be added to SmartGWT, consider either feature sponsorship or just writing the code yourself and contributing it.

        Comment


          #79
          Originally posted by Isomorphic
          Given a bean you've created and registered with Hibernate [...]
          Can I use the Hibernate Entity Manager, or do I have to use the legacy Session Factory interface?

          Originally posted by Isomorphic
          you can use the Hibernate Bean wizard in the Visual Builder to generate a DataSource .ds.xml file from it.
          I am trying to integrate the Visual Builder to my SmartGWT application. To run it, I had to add various JAR files from the smartclient SDK directory (besides the standard ones from the runtime directory.)

          Now I am able to run the Visual Builder from my application, but when it is launched, I get the following 404 requests:

          tools/visualBuilder/undefined/tools/visualBuilder/customComponents.xml

          tools/visualBuilder/undefined/tools/visualBuilder/defaultComponents.xml

          If I try to start the datasoure wizard, it tries to load this:

          tools/visualBuilder/undefined/tools/visualBuilder/dataSourceWizards.xml (0:0:0:0:0:0:0:1)

          * * *

          From the "undefined" in the path, it's clear that there is a settings somewhere which I have missed. Where do I find it?

          Thank you for your help:

          Kristof
          Last edited by csillag; 18 Nov 2009, 09:05.

          Comment


            #80
            Originally posted by Isomorphic
            Given a bean you've created and registered with Hibernate you can use the Hibernate Bean wizard in the Visual Builder to generate a DataSource .ds.xml file from it.
            This takes care of getting the data from server side to the data-bound UI components at the client side.

            How do I access my data on the client side for all other purposes?

            Does the DataSource provide methods for extracting the data at the client side, and use it as I see fit?

            How about actually accessing the data on the client side in the form of domain objects?

            Before turning to SmargGWT ee, I have been using client-side data integration. I had a simple DAO at server side (building on top of JPA), exposed for the client via GWT RPC, so I could just fetch the domain objects and use them on the client side, and also feed them into the datasource as necessary.

            If I understand this correctly, If I switch to SmartGWT-EE with the hibernate bean connector, as far as the data-bound components are concerned, I do not need the server-side DAO and servlet any more, since they are replaced by the ISC server.

            But still, I would not like to lose the ability to work with domain objects at the client side. Obviously, implementing an other DAO in parallel the hibernate connector would be stupid... so, could you please tell me the right approach around this?

            Thank you for your help:

            Kristof

            Comment


              #81
              @csillag The Hibernate Wizard discovers entities by looking for a hibernate.cfg.xml file under WEB-INF, or in the location you specify via hibernate.config in server.properties. If this isn't how you want to use Hibernate, a fall back strategy would be to use the generic Bean wizard to generate DataSources by Java classname, and then use the resulting DataSource file with a custom DataSource as shown in this sample, which has a complete Hibernate-based DataSource similar to the built-in Hibernate connector.

              On running Visual Builder, you should remove anything you might have grabbed from the SmartClient SDK - this is never, ever correct - and instead simply import the Tools module as described here.

              Any DataSource allows direct fetching of data for programmatic client-side use via DataSource.fetchData().

              As far as working with domain objects on the client-side, if you were to go further with your existing approach, you'd shortly find that the domain objects would no longer be usable on the client-side: they would either pull in huge amounts of data due to their relationships with other entities, or they would reference libraries not compatible with GWT's restricted client-side Java support.

              At the point if you did not have Pro/EE you would have to start writing "DTOs" as client-side stand-ins for your domain objects. Pro/EE avoids the need to write DTOs by using the DataSource definition to extract only relevant data from your domain objects.

              While it's possible to build specialized client-side domain objects that have limited business logic, it's usually more effective to just use a "Flyweight" pattern where you have a library of utility functions that act on the generic Record class, or if you really prefer beans, first convert a Record to a bean and then act on the bean. In the latter case you have effectively reinvented the DTO, but you will only need it for cases where non-trivial, bean-specific logic is occurring which cannot be captured by the many declarative mechanisms within SmartGWT - in other words, very rare.

              Comment


                #82
                Originally posted by Isomorphic
                On running Visual Builder, you should remove anything you might have grabbed from the SmartClient SDK - this is never, ever correct - and instead simply import the Tools module as described here.
                If I do that (and only that), the VisualBuilder tries to load when I click on the button, but then I get an 505 because adminConsole.app.xml can not be found it webRoot/tools/...
                In fact it's inside webRoot/<my module>/tools/..., so I symlinked the tools directory to /webRoot (workaround #1). But then, I get a NullPointerException in vpOperations.jsp, which (as revealed on the console) is caused by a ClassNotFoundException for com.isomorphic.tools.AdminConsole.

                Therefore, I have added isomorphic_tools.jar (and dependencies) from smartClientSDK, as you have suggested here (workaround #2). (Or is this obsolete suggestion now? How to avert this bug, then?)

                With this, the console finally loads, but when I click on "New datasource", I get a 404 for tools/visualBuilder/undefined/tools/visualBuilder/dataSourceWizards.xml.

                Where does this "undefined/tools/visualBuilder" path come from?

                (And what am I missing? The import for com.smartgwtee.tools.Tools is definitely there in my gwt module definition, as proven my the copied "tools" directory, which comes from this module.)

                Comment


                  #83
                  Again, never, ever mix resources from SmartClient with SmartGWT. The Installation forum is a SmartClient NOT SmartGWT forum and tips you find there do not apply.

                  You are most likely using GWT 1.6 or later and have not set isomorphicDir as indicated in the FAQ:

                  <script> var isomorphicDir = "MODULE_NAME/sc/"; </script>
                  It's not clear what's the cause of the other errors since we don't know what resources you're using that are still from SmartClient. It might be best to start over and follow only SmartGWT-related instructions this time.

                  Comment


                    #84
                    Originally posted by Isomorphic
                    Again, never, ever mix resources from SmartClient with SmartGWT.
                    This document is clearly about integrating the server portion of SmartGWT-EE into my application, and it specifically says to "Copy all files from the WEB-INF/lib directory of the smartclientRuntime to your WEB-INF/lib."

                    To me, this looks like mixing resources from SmartClient and SmartGWT. What am I misunderstanding?

                    You are most likely using GWT 1.6 or later
                    Yes.

                    and have not set isomorphicDir as indicated in the FAQ
                    I have set it, and it works OK for other things, only the admin console does not work.

                    It's not clear what's the cause of the other errors since we don't know what resources you're using that are still from SmartClient. It might be best to start over and follow only SmartGWT-related instructions this time.
                    Basically, this is what I am trying to do. (I am using the document I have referenced above as my guide.)

                    Comment


                      #85
                      Originally posted by csillag
                      This document is clearly about integrating the server portion of SmartGWT-EE into my application, and it specifically says to "Copy all files from the WEB-INF/lib directory of the smartclientRuntime to your WEB-INF/lib."

                      To me, this looks like mixing resources from SmartClient and SmartGWT. What am I misunderstanding?
                      @isomorphic Dear Isomorphic, I still could not solve this.

                      Comment


                        #86
                        Originally posted by csillag
                        @isomorphic Dear Isomorphic, I still could not solve this.
                        I replaced the JAR files previously copied from the SmartClient distribution with the ones from the SmargGWT-EE distribution, but this did not change anything: the "undefined" element still remains in the URLs the client tries to fetch.

                        @isomorphic, could you please tell me what could be wrong?

                        For the time being, I have just placed a few symlinks here and there to make things work. (Also had do tell Jetty not to reject symlinks.) This is clearly only a temporary workaround; I need to solve this properly.

                        Comment


                          #87
                          Originally posted by csillag
                          @isomorphic, could you please tell me what could be wrong?
                          Never mind, the problem went away after one more night of experimentation.

                          Comment


                            #88
                            Originally posted by Isomorphic
                            Any DataSource allows direct fetching of data for programmatic client-side use via DataSource.fetchData().
                            Thank you, this is working fine now.

                            One more question: what is the recommended approach for server-side access to the same data? (Independently of any client-initiated CRUD operations.) In the current example, I am working with the built-in SQL connector.

                            Comment


                              #89
                              Glad to hear you sorted out your installation issues.

                              You can programmatically perform a server-side DataSource operation by just creating a new DSRequest and executing it:

                              Code:
                              DSRequest dsRequest = new DSRequest([i]dataSourceId[/i], "fetch");
                              DSResponse dsResponse = dsRequest.execute();
                              At this point dsResponse.getData() gives you access to whatever the DataSource returned.

                              DSRequest has various further APIs to configure sort direction, page size, etc.

                              Comment


                                #90
                                Originally posted by Isomorphic
                                You can programmatically perform a server-side DataSource operation by just creating a new DSRequest and executing it
                                I see. If I modify data on the server side, how do I fix the automatic cache synchronization? (If I don't do anything, the client does not seem to be notified.) What is the recommended way to trigger an update on the client?

                                Comment

                                Working...
                                X