Announcement

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

    Trouble with includeFrom in datasource

    I have two datasources, directly referencing tables in a database. I can't get the includeFrom to work. My econMetric datasource references the countryHB datasource. I get the following error:
    ORA-00904: "ECON_METRIC"."COUNTRY_NAME": invalid identifier

    Here is the stack trace:
    Code:
    === 2013-01-25 08:06:26,182 [ec-1] INFO  SQLDriver - [builtinApplication.econodayMetric_fetch] Executing SQL query on 'OIL': SELECT COUNT(*) FROM OIL.ECON_METRIC WHERE ('1'='1')
    === 2013-01-25 08:06:26,182 [ec-1] DEBUG SQLDataSource - [builtinApplication.econodayMetric_fetch] JDBC driver windowed select rows 0->54, result size 54. Query: SELECT ECON_METRIC.ACTUAL, ECON_METRIC.AS_OF, ECON_METRIC.CONSENSUS, ECON_METRIC.CONSENSUS_RANGE, ECON_METRIC.COUNTRY_ID, ECON_METRIC.CREATED_ON, ECON_METRIC.DATA_TYPE, ECON_METRIC.ECON_METRIC_ID, ECON_METRIC.LAST_UPDATE, ECON_METRIC.LOOKUP_ID, ECON_METRIC.PREVIOUS, ECON_METRIC.SUB_TYPE, ECON_METRIC.SUB_TYPE_ID, ECON_METRIC.UNITS, ECON_METRIC.country_name FROM OIL.ECON_METRIC WHERE ('1'='1')
    === 2013-01-25 08:06:26,182 [ec-1] WARN  RequestContext - dsRequest.execute() failed: 
    java.sql.SQLException: ORA-00904: "ECON_METRIC"."COUNTRY_NAME": invalid identifier
    As you can see from the SQL in the stack trace, SmartGWT is trying to get country_name from the econ_metric table (ECON_METRIC.country_name), which is wrong. It is like the countryHB is not being used at all in the first datasource.

    I have checked, double-checked and triple-checked everything. This should be simple. Where am I going wrong?

    Here are the data sources...

    Code:
    <DataSource 
    schema="METRICS" 
    dbName="METRICS" 
    tableName="econ_metric"
    ID="econMetric" 
    dataSourceVersion="1" 
    serverType="sql">
    
    	<fields>
    		<field name="ECON_METRIC_ID" type="sequence" hidden="true" primaryKey="true" sequenceName="ECON_METRIC_SEQ" />
    		
    		<field name="SUB_TYPE_ID" type="number" title="" width="300"  hidden="true" />
    		<field name="DATA_TYPE" type="text" title="" width="150" />
    		<field name="SUB_TYPE" type="text" title="" width="150" />
    		
            <field includeFrom="countryHB.country_name" hidden="true" />  
            <field name="COUNTRY_ID" type="integer"  foreignKey="countryHB.country_id" width="300"/>  
    		
    		<field name="AS_OF" type="date" title="" width="100" />
    		<field name="UNITS" type="text" title="" width="50"  hidden="true" />
    		<field name="ACTUAL" type="float" title="" width="50" />
    		<field name="CREATED_ON" type="datetime" title="" width="100" />
    		<field name="LOOKUP_ID" type="text" title="" width="300" hidden="true" />
    		<field name="LAST_UPDATE" type="datetime" title="" width="100" />
    		
    	</fields>
    
    </DataSource>
    and one for the country table...

    Code:
    <DataSource
            schema="METRICS"
            dbName="METRICS"
            tableName="COUNTRY"
            ID="countryHB"
            dataSourceVersion="1"
            serverType="sql"
            >
        <fields>
            <field name="COUNTRY_ID" type="number" hidden="true" title="Country ID" primaryKey="true" />
            <field name="COUNTRY_NAME"  type="text" />
            <field name="CODE"           		type="text" />
            <field name="IS_OPEC"               type="number" />
            
        </fields>
    
    </DataSource>

    #2
    Identifiers are case-sensitive - does it work if the includeFrom uses COUNTRY_NAME?

    Comment


      #3
      Solved

      Thanks, Isomorphic. It was as simple as that. Honestly, after 12 years as a Java developer you'd think I might have spotted that!

      Comment

      Working...
      X