Announcement

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

    Spring roo & SmartGwt With Rest

    Hi,

    I use Smartgwt power version 3.0

    I have see this tutorial :
    http://technowobble.blogspot.com/2010/08/using-smartgwt-with-jersey-restful.html

    I have test it and I like it !

    I don't now for what we need to buy the power version, because I think that Datasource in smartGwt not offer a well customisation for databinding and have some background behaviour that we can not custom! SmartGwt is Smart but too much.

    I have execute the tutorial, and I think do this way is better because we can make some SQL statement in aspect4j file.
    The Databinding work with RequestFactory : http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideRequestFactory.html

    All Sql statement and Find, FindBy, .... methods are in .aj file. These aspect files are generated by spring roo and we can modify or add some methods for do some SQL statements that we need. (see EntityManager class)

    I think that SmartGwt datasource are good for CRUD applications, BUT THAT'S ALL.
    So power version is useless ?
    Should I have to do RPC ? (my boss doesn't want)
    <CustomSql> in datasource ?
    Or use spring roo
    Or what ?

    Have you a sample and a tutorial ? I have to do a select distinct, A join ... and more

    Thanks,

    #2
    At the end of this tutorial, with a lot of extra steps, you end up with something that replicates the simple SQL connector, without transactions, without autoDeriveSchema, and with none of the power of SQL Templating, nor any of the dozens of other major non-SQL features that are part of the server framework. So no, this nothing close to Power Edition, or even Pro.

    Read the QuickStart Guide and look at the samples in the EE Showcase to get an idea of the full scope of features.

    Also, the SmartGWT server is in no way limited to CRUD.

    About GWT-RPC, see the FAQ for why it's a bad idea. The RequestFactory pattern meant as a successor to GWT-RPC suffers from most of the same drawbacks, plus new ones. Also, it's not ready for production use yet.

    Comment


      #3
      For Sql, you have simply to do the following code :

      Collection<Message> messages = Message.findMessageEntries(request.getStartRow(), 1 + (request.getEndRow() -
      request.getStartRow()));

      And you can customize the findMessageEntries with SQL statement with one of these methods of the class EntityManager

      Query createNamedQuery(String name)
      Create an instance of Query for executing a named query (in the Java Persistence query language or in native SQL).
      Query createNativeQuery(String sqlString)
      Create an instance of Query for executing a native SQL statement, e.g., for update or delete.
      Query createNativeQuery(String sqlString, Class resultClass)
      Create an instance of Query for executing a native SQL query.
      Query createNativeQuery(String sqlString, String resultSetMapping)
      Create an instance of Query for executing a native SQL query.
      Query createQuery(String qlString)
      Create an instance of Query for executing a Java Persistence query language statement.

      Isn't it a good way ?

      Comment


        #4
        Ok I have see this code on SmartGwt EE ShowCase

        I Think I do this way

        Code:
        # <operationBindings>  
        #     <!-- Special fetch operation - summarize order items in a given date range -->  
        #     <operationBinding   
        #         operationId="summary"  
        #         operationType="fetch"   
        #         customFields="itemName, totalSales, SKU, unitCost"   
        #     >  
        #         <selectClause>  
        #             dynRepOrderItem.itemID, itemName, SKU, unitCost,  
        #             SUM(quantity) AS quantity,  
        #             SUM(quantity * unitCost) AS totalSales  
        #         </selectClause>  
        #         <tableClause>dynRepOrderItem, supplyItem</tableClause>  
        #         <whereClause><![CDATA[ 
        #                 dynRepOrderItem.itemID = supplyItem.itemID 
        #             AND orderDate >= $criteria.startDate 
        #             AND orderDate <= $criteria.endDate 
        #             ]]>  
        #         </whereClause>  
        #         <groupClause>  
        #             dynRepOrderItem.itemID, itemName,SKU, unitCost  
        #         </groupClause>  
        #         <groupWhereClause>($defaultWhereClause)</groupWhereClause>  
        #     </operationBinding>  
        # </operationBindings>  
        #       
        # </DataSource>



        An in ORM Datasource I see this
        Code:
        #     private List fetchRecords (Map criteria) {  
        #         Session ses = null;  
        #         Transaction tx = null;  
        #         try {  
        #             ses = getSession();  
        #             tx = ses.beginTransaction();  
        #             Query q = ses.createQuery("from com.smartgwt.sample.showcase.server.customDataSource.Country");  
        #             List records = q.list();  
        #             tx.commit();  
        #             return records;  
        #         } finally {  
        #             if (tx != null) {  
        #                 if (tx.isActive()) tx.rollback();  
        #             }  
        #             if (ses != null) ses.close();  
        #         }  
        #     }
        Is it possible to create native SQL query Statements ?

        Have anybody do an application with some <OperationBinding> in sql ?

        Can I have the sources or an svn link in order to run a sample ?

        If it use a DataBase (no in-memory mode) I wiil create one no problem.

        Comment

        Working...
        X