Announcement

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

    multiple includeFrom

    Hello,
    I receive an error while including two fields from the same datasource.


    WARN DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring. Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name


    The value for both the included fields is not shown.

    Datasource is:

    Code:
    <DataSource ID="order_DataSource" serverType="jpa"
    	serverContructor="com.isomorphic.jpa.JPA2DataSource" schemaBean="com.realanywhere.domain.OrderHeader"
    	autoDeriveSchema="true">
    
    	<fields>
    		<field name="id" hidden="true" type="sequence" primaryKey="true" />
    		<field name="shipToName" includeFrom="stakeholder_DataSource.name"/>		
    		<field name="shipTo" foreignKey="stakeholder_DataSource.id" />
     		<field name="shipFromName" includeFrom="stakeholder_DataSource.name"/>
     		<field name="shipFrom" foreignKey="stakeholder_DataSource.id" />
            ...
            </fields>
    </Datasource>
    while the classese are JPA mapped pojos like:
    Code:
    public class OrderHeader {	
    
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id")
        private Long id;
    
        String orderNumber;
    	
        @ManyToOne(fetch = FetchType.LAZY)
        Stakeholder shipTo;
    	
        @ManyToOne(fetch = FetchType.LAZY)
        Stakeholder shipFrom;
            ...
    Code:
    public class Stakeholder {	
    
        @Id
        @GeneratedValue(strategy = GenerationType.AUTO)
        @Column(name = "id")
        private Long id;
    
        String name;
    
        ...
    }
    BTW: if i comment out the "shipFrom" definition (NULL in the database) in OrderHeader datasource the remaining field shipTo is correctly shown.

    How should the datasource be defined?

    THank you!

    Using smargwtee 3.1p
    Any browser
    Last edited by devep1; 14 Jan 2013, 03:59.

    #2
    Looks like you are hoping that each of the includeFrom's will be associated with the preceding foreignKey. This isn't the case; currently there isn't a way to use multiple includeFroms from the same related DataSource.

    There are many ways around this, but one is to configure eager fetching for one of the two entities (say shipFrom) and use field.valueXPath.

    Comment


      #3
      Originally posted by Isomorphic View Post
      There are many ways around this, but one is to configure eager fetching for one of the two entities (say shipFrom) and use field.valueXPath.
      Sorry I didn't really catch your suggestion about field.valueXPath

      Do you mean I have to define a rest/json interface?
      Can you point me to a sample/doc?

      Thank you.

      Comment


        #4
        http://www.smartclient.com/smartgwte...tml#valueXPath

        You don't have to declare "rest/json interface", just use valueXPath instead of includeFrom.

        Comment


          #5
          I've changed my datasource to
          Code:
          <DataSource ID="order_DataSource" serverType="jpa"
          	serverContructor="com.isomorphic.jpa.JPA2DataSource" schemaBean="com.realanywhere.domain.OrderHeader"
          	autoDeriveSchema="true">
          
          	<fields>
          		<field name="id" hidden="true" type="sequence" primaryKey="true" />
          		<field name="version" hidden="true" />
          		<field name="shipToName" valueXPath="shipTo/name" />
          		<field name="shipFromName" valueXPath="shipFrom/name" />
          		<!-- <field name="shipToName" includeFrom="shipTo_DataSource.name" /> -->
          		<!-- <field name="shipTo" foreignKey="shipTo_DataSource.id" /> -->
          		<!-- <field name="shipFromName" includeFrom="stakeholder_DataSource.name"/> -->
          		<!-- <field name="shipFrom" foreignKey="stakeholder_DataSource.id" /> -->
          		<field name="carrier" type="enum" title="Carrier">
          			<valueMap>
          				<value>FRANCOPARTENZA</value>
          				<value>RAILWAY</value>
          				<value>FRANCOARRIVO</value>
          			</valueMap>
          		</field>
          
          		<field name="orderLines" multiple="true" TITLE="Order lines"
          			type="orderLine_DataSource" javaClass="com.realanywhere.domain.OrderLine" />
          	</fields>
          </DataSource>
          but still no luck.

          Error log is:
          Code:
          [INFO] ISC: Configuring log4j from: file:/home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/WEB-INF/classes/log4j.isc.config.xml
          [INFO] === 2013-01-16 13:55:39,073 [main] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from com.isomorphic.base.Init
          [INFO] === 2013-01-16 13:55:39,132 [main] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework - Initializing
          [INFO] === 2013-01-16 13:55:39,889 [main] INFO  ConfigLoader - Attempting to load framework.properties from CLASSPATH
          [INFO] === 2013-01-16 13:55:40,298 [main] INFO  ConfigLoader - Successfully loaded framework.properties from CLASSPATH at location: jar:file:/home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/WEB-INF/lib/isomorphic_core_rpc-3.1.jar!/framework.properties
          [INFO] === 2013-01-16 13:55:40,298 [main] INFO  ConfigLoader - Attempting to load project.properties from CLASSPATH
          [INFO] === 2013-01-16 13:55:40,565 [main] INFO  ConfigLoader - Unable to locate project.properties in CLASSPATH
          [INFO] === 2013-01-16 13:55:40,569 [main] INFO  ConfigLoader - Successfully loaded isc_interfaces.properties from CLASSPATH at location: jar:file:/home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/WEB-INF/lib/isomorphic_core_rpc-3.1.jar!/isc_interfaces.properties
          [INFO] === 2013-01-16 13:55:40,569 [main] INFO  ConfigLoader - Attempting to load server.properties from CLASSPATH
          [INFO] === 2013-01-16 13:55:40,699 [main] INFO  ConfigLoader - Successfully loaded server.properties from CLASSPATH at location: file:/home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/WEB-INF/classes/server.properties
          [INFO] === 2013-01-16 13:55:40,706 [main] INFO  Logger - Logging system started.
          [INFO] === 2013-01-16 13:55:40,707 [main] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework (v8.3_2012-11-20/EVAL Deployment 2012-11-20) - Initialization Complete
          [INFO] === 2013-01-16 13:55:40,779 [main] INFO  ISCInit - Auto-detected webRoot - using: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT
          [INFO] === 2013-01-16 13:57:43,993 [l0-6] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework initialization called from com.isomorphic.base.Base
          [INFO] === 2013-01-16 13:57:43,995 [l0-6] INFO  ISCInit - Isomorphic SmartClient/SmartGWT Framework is already initialized
          [INFO] === 2013-01-16 13:57:45,318 [l0-6] INFO  PoolManager - SmartClient pooling disabled for 'order_DataSource' objects
          [INFO] === 2013-01-16 13:57:45,987 [l0-3] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/load_skin.js
          [INFO] === 2013-01-16 13:57:46,271 [l0-3] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/skin_styles.css
          [INFO] === 2013-01-16 13:57:48,978 [l0-6] INFO  RequestContext - URL: '/applicationScaffold/sc/IDACall', User-Agent: 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11': Safari with Accept-Encoding header
          [INFO] === 2013-01-16 13:57:49,041 [l0-3] INFO  RequestContext - URL: '/applicationScaffold/sc/IDACall', User-Agent: 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11': Safari with Accept-Encoding header
          [INFO] === 2013-01-16 13:57:49,101 [l0-3] INFO  IDACall - Performing 1 operation(s)
          [INFO] === 2013-01-16 13:57:49,101 [l0-6] INFO  IDACall - Performing 1 operation(s)
          [INFO] === 2013-01-16 13:57:49,235 [l0-5] INFO  RequestContext - URL: '/applicationScaffold/sc/IDACall', User-Agent: 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11': Safari with Accept-Encoding header
          [INFO] === 2013-01-16 13:57:49,313 [l0-5] INFO  IDACall - Performing 1 operation(s)
          [INFO] === 2013-01-16 13:57:49,867 [l0-4] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/DynamicForm/date_control.png
          [INFO] === 2013-01-16 13:57:49,867 [l0-2] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/loadingSmall.gif
          [INFO] === 2013-01-16 13:57:49,868 [l0-0] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/blank.gif
          [INFO] === 2013-01-16 13:57:49,873 [l0-0] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/RecordEditor/filter.png
          [INFO] === 2013-01-16 13:57:49,915 [l0-0] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/pickers/comboBoxPicker.png
          [INFO] === 2013-01-16 13:57:49,919 [l0-0] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/ListGrid/headerSprite.png
          [INFO] === 2013-01-16 13:57:53,567 [l0-5] INFO  DSResponse - [builtinApplication.product_DataSource_fetch] DSResponse: List with 50 items
          [INFO] === 2013-01-16 13:57:53,768 [l0-6] INFO  DSResponse - [builtinApplication.order_DataSource_fetch] DSResponse: List with 3 items
          [INFO] === 2013-01-16 13:57:53,768 [l0-3] INFO  DSResponse - [builtinApplication.order_DataSource_fetch] DSResponse: List with 3 items
          [INFO] === 2013-01-16 13:57:54,690 [l0-4] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/Scrollbar/vthumb_grip.png
          [INFO] === 2013-01-16 13:57:54,738 [l0-0] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/Scrollbar/vscroll_track.png
          [INFO] === 2013-01-16 13:57:54,740 [l0-5] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/Scrollbar/vscroll_start.png
          [INFO] === 2013-01-16 13:57:54,740 [l0-2] INFO  Download - Returning 304: Not modified on conditional get of: /home/lrkwz/car/car-parent/car-smartgwt-webapp/target/websales-car-0.1.0.BUILD-SNAPSHOT/applicationScaffold/sc/skins/Enterprise/images/Scrollbar/vscroll_end.png
          [INFO] === 2013-01-16 13:57:54,891 [l0-3] WARN  DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name
          [INFO] === 2013-01-16 13:57:54,891 [l0-6] WARN  DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name
          [INFO] === 2013-01-16 13:57:56,254 [l0-3] WARN  DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name
          [INFO] === 2013-01-16 13:57:56,270 [l0-6] WARN  DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name
          [INFO] === 2013-01-16 13:57:56,865 [l0-3] WARN  DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name
          [INFO] === 2013-01-16 13:57:56,890 [l0-6] WARN  DataSource - Couldn't get value at valueXPath: shipFrom/name for datasource: order_DataSource - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: shipFrom/name
          Last edited by devep1; 24 Jan 2013, 02:44.

          Comment


            #6
            You also need to configure eager fetching for the field where you are using valueXPath (see previous post).

            Comment

            Working...
            X