Announcement

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

    SQL DataSource definition based on SchemaBean

    smartgwtpower-3.1p/database: DB2/browser: Firefox 18.0.1

    Hello,

    I try to configure an sql-datasource using SchemaBean definition.
    When I try to use it, I have an error from database; if I look at the query I find a strange select.

    This is the Datasource definition:

    Code:
    <DataSource ID="location_DataSource" serverType="sql"
    	schemaBean="com.realanywhere.domain.Location" tableName="Location"
    	beanClassName="com.realanywhere.domain.Location">
    	<fields>
    		<field name="id" hidden="true" type="sequence" primaryKey="true" />
    		<field name="version" hidden="true" />
    
    	</fields>
    </DataSource>
    This is my class with bean definition:
    Code:
    package com.realanywhere.domain;
    
    import java.sql.Timestamp;
    import java.util.Date;
    
    import javax.persistence.ManyToOne;
    
    import org.springframework.roo.addon.javabean.RooJavaBean;
    import org.springframework.roo.addon.jpa.activerecord.RooJpaActiveRecord;
    import org.springframework.roo.addon.tostring.RooToString;
    
    @RooJavaBean
    @RooToString
    @RooJpaActiveRecord
    public class Location {
    	
    	String guid;
    	String code;
    	String name;
    	String description;
    	
    	Date NextPeriodStartDate;
    	Date CurrentPeriodStartDate;
    	Date PreviousPeriodStartDate;
    	Date Previous2PeriodStartDate;
    	
    	Integer division;
    	Integer company;
    	Integer district;
    	Date dateIns;
    	String userIns;
    	Date dateMod;
    	String userMod;
    }
    This is the error:
    Code:
     
    [INFO] === 2013-01-22 13:21:25,249 [l0-2] INFO  SQLWhereClause - [builtinApplication.location_DataSource_fetch] empty condition
    [INFO] === 2013-01-22 13:21:25,250 [l0-2] INFO  SQLDataSource - [builtinApplication.location_DataSource_fetch] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause
    [INFO] === 2013-01-22 13:21:25,341 [l0-2] INFO  SQLDataSource - [builtinApplication.location_DataSource_fetch] Executing SQL query on 'DB2': SELECT location_DataSource_inheritsFrom.CurrentPeriodStartDate, location_DataSource_inheritsFrom.NextPeriodStartDate, location_DataSource_inheritsFrom.Previous2PeriodStartDate, location_DataSource_inheritsFrom.PreviousPeriodStartDate, location_DataSource_inheritsFrom.code, location_DataSource_inheritsFrom.company, location_DataSource_inheritsFrom.dateIns, location_DataSource_inheritsFrom.dateMod, location_DataSource_inheritsFrom.description, location_DataSource_inheritsFrom.district, location_DataSource_inheritsFrom.division, location_DataSource_inheritsFrom.guid, Location.id, location_DataSource_inheritsFrom.name, location_DataSource_inheritsFrom.userIns, location_DataSource_inheritsFrom.userMod, Location.version FROM Location WHERE ('1'='1')
    [INFO] === 2013-01-22 13:21:25,367 [l0-2] INFO  PoolManager - [builtinApplication.location_DataSource_fetch] SmartClient pooling started for 'DB2' objects
    [INFO] === 2013-01-22 13:21:26,027 [l0-2] INFO  SQLDriver - [builtinApplication.location_DataSource_fetch] Executing SQL query on 'DB2': SELECT location_DataSource_inheritsFrom.CurrentPeriodStartDate, location_DataSource_inheritsFrom.NextPeriodStartDate, location_DataSource_inheritsFrom.Previous2PeriodStartDate, location_DataSource_inheritsFrom.PreviousPeriodStartDate, location_DataSource_inheritsFrom.code, location_DataSource_inheritsFrom.company, location_DataSource_inheritsFrom.dateIns, location_DataSource_inheritsFrom.dateMod, location_DataSource_inheritsFrom.description, location_DataSource_inheritsFrom.district, location_DataSource_inheritsFrom.division, location_DataSource_inheritsFrom.guid, Location.id, location_DataSource_inheritsFrom.name, location_DataSource_inheritsFrom.userIns, location_DataSource_inheritsFrom.userMod, Location.version FROM Location WHERE ('1'='1')
    [INFO] === 2013-01-22 13:21:26,896 [l0-2] INFO  SQLDriver - [builtinApplication.location_DataSource_fetch] Execute of select: SELECT location_DataSource_inheritsFrom.CurrentPeriodStartDate, location_DataSource_inheritsFrom.NextPeriodStartDate, location_DataSource_inheritsFrom.Previous2PeriodStartDate, location_DataSource_inheritsFrom.PreviousPeriodStartDate, location_DataSource_inheritsFrom.code, location_DataSource_inheritsFrom.company, location_DataSource_inheritsFrom.dateIns, location_DataSource_inheritsFrom.dateMod, location_DataSource_inheritsFrom.description, location_DataSource_inheritsFrom.district, location_DataSource_inheritsFrom.division, location_DataSource_inheritsFrom.guid, Location.id, location_DataSource_inheritsFrom.name, location_DataSource_inheritsFrom.userIns, location_DataSource_inheritsFrom.userMod, Location.version FROM Location WHERE ('1'='1') on db: DB2 threw exception: com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=LOCATION_DATASOURCE_INHERITSFROM.CURRENTPERIODSTARTDATE, DRIVER=4.13.127 - assuming stale connection and retrying query.
    [INFO] === 2013-01-22 13:21:28,087 [l0-2] WARN  RequestContext - dsRequest.execute() failed: 
    [INFO] com.ibm.db2.jcc.am.SqlSyntaxErrorException: DB2 SQL Error: SQLCODE=-206, SQLSTATE=42703, SQLERRMC=LOCATION_DATASOURCE_INHERITSFROM.CURRENTPERIODSTARTDATE, DRIVER=4.13.127
    [INFO] 	at com.ibm.db2.jcc.am.id.a(id.java:677)
    [INFO] 	at com.ibm.db2.jcc.am.id.a(id.java:60)
    [INFO] 	at com.ibm.db2.jcc.am.id.a(id.java:127)
    [INFO] 	at com.ibm.db2.jcc.am.no.c(no.java:2653)
    [INFO] 	at com.ibm.db2.jcc.am.no.d(no.java:2641)
    [INFO] 	at com.ibm.db2.jcc.am.no.a(no.java:2090)
    [INFO] 	at com.ibm.db2.jcc.t4.cb.h(cb.java:141)
    [INFO] 	at com.ibm.db2.jcc.t4.cb.b(cb.java:41)
    [INFO] 	at com.ibm.db2.jcc.t4.q.a(q.java:32)
    [INFO] 	at com.ibm.db2.jcc.t4.sb.i(sb.java:135)
    [INFO] 	at com.ibm.db2.jcc.am.no.ib(no.java:2059)
    [INFO] 	at com.ibm.db2.jcc.am.no.a(no.java:3130)
    [INFO] 	at com.ibm.db2.jcc.am.no.a(no.java:688)
    [INFO] 	at com.ibm.db2.jcc.am.no.executeQuery(no.java:672)
    [INFO] 	at org.apache.commons.dbcp.DelegatingStatement.executeQuery(DelegatingStatement.java:208)
    [INFO] 	at com.isomorphic.sql.SQLDriver.getTransformedResults(SQLDriver.java:592)
    [INFO] 	at com.isomorphic.sql.SQLDriver.executeQuery(SQLDriver.java:848)
    [INFO] 	at com.isomorphic.sql.SQLDataSource.executeNativeQuery(SQLDataSource.java:407)
    [INFO] 	at com.isomorphic.sql.SQLDataSource.executeNativeQuery(SQLDataSource.java:401)
    [INFO] 	at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1394)
    [INFO] 	at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:306)
    [INFO] 	at com.isomorphic.sql.SQLDataSource.executeFetch(SQLDataSource.java:250)
    [INFO] 	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1367)
    [INFO] 	at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:726)
    [INFO] 	at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
    [INFO] 	at com.isomorphic.application.AppBase.execute(AppBase.java:491)
    [INFO] 	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2031)
    [INFO] 	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:216)
    [INFO] 	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:173)
    [INFO] 	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
    [INFO] 	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
    [INFO] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    [INFO] 	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
    [INFO] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    [INFO] 	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
    [INFO] 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1097)
    [INFO] 	at com.isomorphic.servlet.CompressionFilter.doFilter(CompressionFilter.java:259)
    [INFO] 	at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1088)
    [INFO] 	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:360)
    [INFO] 	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    [INFO] 	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
    [INFO] 	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
    [INFO] 	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
    [INFO] 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    [INFO] 	at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
    [INFO] 	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    [INFO] 	at org.mortbay.jetty.Server.handle(Server.java:324)
    [INFO] 	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
    [INFO] 	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
    [INFO] 	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
    [INFO] 	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
    [INFO] 	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
    [INFO] 	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
    [INFO] 	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
    Why in the "Select" I find element just like "location_DataSource_inheritsFrom.CurrentPeriodStartDate"?

    Any hints would be appreciated. Tahnk you.

    #2
    Try setting autoDeriveSchema=true

    Comment


      #3
      I've also done that, with the same result.

      This is the client:

      Code:
      public void onModuleLoad() {
      final ListGrid productGrid = new ListGrid();  
      		productGrid.setWidth(700);  
      		productGrid.setHeight(224);  
      		productGrid.setAlternateRecordStyles(true);  
      		productGrid.setDataSource(DataSource.get("location_DataSource"));  
      		productGrid.setWidth100();
      		productGrid.setHeight(150);
      		productGrid.setAlternateRecordStyles(true);
      		productGrid.setAutoFetchData(true);
      		productGrid.setDataPageSize(50);
      		productGrid.setShowFilterEditor(true);        
        
              IButton newButton = new IButton("Add New");  
              newButton.addClickHandler(new ClickHandler() {  
                  public void onClick(ClickEvent event) {  
                  	productGrid.startEditingNew();  
                  }  
              });  
        
        
              VLayout layout = new VLayout(15);  
              layout.addMember(productGrid);  
              layout.addMember(newButton);  
        
              layout.draw(); 
      		
      	}
      Last edited by devep1; 22 Jan 2013, 08:32.

      Comment


        #4
        When you use autoDeriveSchema there's an implicit, generated DataSource that your actual DataSource is set up to inherit from. Your logs suggest that somehow this implicit DataSource is getting queried.

        We can't see how that could happen, but the first thing to do is to post the complete server log for the request (always required when posting about server errors).

        Comment


          #5
          Originally posted by Isomorphic View Post
          When you use autoDeriveSchema there's an implicit, generated DataSource that your actual DataSource is set up to inherit from. Your logs suggest that somehow this implicit DataSource is getting queried.

          We can't see how that could happen, but the first thing to do is to post the complete server log for the request (always required when posting about server errors).
          Sorry this problem is better addressed by http://forums.smartclient.com/showthread.php?t=25159

          Comment

          Working...
          X