Announcement

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

    Filter on foreign table

    Hi,

    I need to filter the result of a query in a listgrid by the field of a foreign table.
    So I have a table A, which references a table B with foreign key B.fk1, I need to filter by value B.2
    How should I do this? I see this is directly possible in the power versión, to which I don't have access. So I guess the way to go is to somehow map field B.2 into the datasource of A, aqnd then programmatically filter in a DMI call.

    But how would I map that foreign field? I should I follow a different approach?

    I'm using smartgwt 2.5, pro versión

    cheers Bo

    #2
    Not an easy problem if you want a complete solution that actually does filtering using the database, which is why it's part of Power. Upgrading to Power is possible by only paying the difference.

    Comment


      #3
      Ok, but is it possible to map a field of a foreign table into a datasource, and the use it? How would I do that? (ideal would be some datapath construction, but I belief that doesn't exist in datasources?)

      thanks in advance,
      Bo

      Comment


        #4
        You haven't specified what kind of DataSource you're using.

        The way to do it for SQL is explained in the QuickStart Guide section(s) on SQL Templating. For JPA and Hibernate it's done via dataSourceField.valueXPath.

        Comment


          #5
          I'm using a sql datasource.

          I guess the SQL templating is the option I saw that was only available for the power version, or is there a way to use it with the pro version?

          regards Bo

          Comment


            #6
            SQL Templating is a Power feature - the full breakdown is here.

            Comment


              #7
              Hi,

              I have the hibernate definitions in place, which works correctly in a separate test. I'm getting an error when applying the valueXPath property " valueXPath="tema/canal/idcanal" " in datasource "noticias".

              I have 3 tables in place, the datasource definitions are:

              Code:
              <DataSource ID="noticias" serverType="hibernate" tableName="noticia"
              	autoDeriveSchema="true" >
              
              	<fields>
              		<field name="idnoticia" hidden="true" />
              		<field name="titulo" type="text"/>
              		<field name="idtema" title="Tema" type="integer" foreignKey="temas.idtema"  />
              		<field name="idcanal" title="Canal" type="integer" valueXPath="tema/canal/idcanal"  />
              		<field name="campo1" type="text" hidden="true"/>
              		<field name="campo2" type="text" hidden="true"/>
              	</fields>
              
              </DataSource>
              Code:
              <DataSource ID="temas" serverType="hibernate" tableName="tema" autoDeriveSchema="true" />
              Code:
              <DataSource ID="canales" serverType="hibernate" tableName="canal" autoDeriveSchema="true" />
              I have 3 java classes, Noticia, Tema and Canal
              Noticia has a method called Tema getTema(){..}, and Tema has a method called "Canal getCanal(){..}", Canal has a method called "Integer getIdcanal(){..}"

              Is there any reason why this doesn't seem to work?

              Here's the stacktrace when I try to load a datasource and then a listGrid. The relevant error seems to be "=== 2011-09-16 16:29:43,121 [0-21] INFO DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring. Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal", but the methods are defined in the beans, and noticia.getTema().getCanal().getIdcanal() gives a valid result in a test case.
              Code:
              === 2011-09-16 16:29:42,387 [0-21] INFO  RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1': Safari with Accept-Encoding header
              === 2011-09-16 16:29:42,387 [0-21] DEBUG XML - Parsed XML from (in memory stream): 0ms
              === 2011-09-16 16:29:42,403 [0-21] DEBUG RPCManager - Processing 1 requests.
              === 2011-09-16 16:29:42,403 [0-21] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                  },
                  operationConfig:{
                      dataSource:"temas",
                      operationType:"fetch"
                  },
                  appID:"builtinApplication",
                  operation:"temas_fetch",
                  oldValues:null
              }
              === 2011-09-16 16:29:42,403 [0-21] INFO  IDACall - Performing 1 operation(s)
              === 2011-09-16 16:29:42,403 [0-21] DEBUG AppBase - [builtinApplication.temas_fetch] No userTypes defined, allowing anyone access to all operations for this application
              === 2011-09-16 16:29:42,403 [0-21] DEBUG AppBase - [builtinApplication.temas_fetch] No public zero-argument method named '_temas_fetch' found, performing generic datasource operation
              === 2011-09-16 16:29:42,403 [0-21] INFO  HibernateDataSource - [builtinApplication.temas_fetch] Performing fetch operation with
              	criteria: {}	values: {}
              === 2011-09-16 16:29:42,403 [0-21] DEBUG HibernateTransaction - [builtinApplication.temas_fetch] Started new transaction "15762961"
              Hibernate: select this_.idtema as idtema11_0_, this_.nombre as nombre11_0_, this_.idcanal as idcanal11_0_, this_.tipoobjetoseguridad as tipoobje4_11_0_, this_.nombreobjetoseguridad as nombreob5_11_0_, this_.idiomapsml as idiomapsml11_0_, this_.paispsml as paispsml11_0_, this_.tipomediopsml as tipomedi8_11_0_, this_.ficheropsml as ficherop9_11_0_, this_.nombrepanel as nombrep10_11_0_, this_.panel as panel11_0_ from public.tema this_
              === 2011-09-16 16:29:42,450 [0-21] INFO  DSResponse - [builtinApplication.temas_fetch] DSResponse: List with 51 items
              === 2011-09-16 16:29:42,450 [0-21] INFO  HibernateTransaction - [builtinApplication.temas_fetch] Attempting to commit 0 database update(s)
              === 2011-09-16 16:29:42,450 [0-21] DEBUG HibernateTransaction - [builtinApplication.temas_fetch] Committing transaction "15762961"
              === 2011-09-16 16:29:42,465 [0-21] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2011-09-16 16:29:42,465 [0-21] DEBUG RPCManager - non-DMI response, dropExtraFields: false
              === 2011-09-16 16:29:42,465 [0-21] DEBUG HibernateTransaction - Closing session "15762961"
              === 2011-09-16 16:29:42,481 [0-21] DEBUG HibernateTransaction - Removed transaction "15762961"
              === 2011-09-16 16:29:42,903 [0-21] INFO  RequestContext - URL: '/builtinds/sc/IDACall', User-Agent: 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1': Safari with Accept-Encoding header
              === 2011-09-16 16:29:42,903 [0-21] DEBUG XML - Parsed XML from (in memory stream): 0ms
              === 2011-09-16 16:29:42,918 [0-21] DEBUG RPCManager - Processing 1 requests.
              === 2011-09-16 16:29:42,918 [0-21] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                  },
                  operationConfig:{
                      dataSource:"noticias",
                      operationType:"fetch",
                      textMatchStyle:"exact"
                  },
                  startRow:0,
                  endRow:75,
                  componentId:"isc_ListGrid_1",
                  appID:"builtinApplication",
                  operation:"noticias_fetch",
                  oldValues:{
                  }
              }
              === 2011-09-16 16:29:42,918 [0-21] INFO  IDACall - Performing 1 operation(s)
              === 2011-09-16 16:29:42,918 [0-21] DEBUG AppBase - [builtinApplication.noticias_fetch] No userTypes defined, allowing anyone access to all operations for this application
              === 2011-09-16 16:29:42,918 [0-21] DEBUG AppBase - [builtinApplication.noticias_fetch] No public zero-argument method named '_noticias_fetch' found, performing generic datasource operation
              === 2011-09-16 16:29:42,918 [0-21] INFO  HibernateDataSource - [builtinApplication.noticias_fetch] Performing fetch operation with
              	criteria: {}	values: {}
              === 2011-09-16 16:29:42,918 [0-21] DEBUG HibernateTransaction - [builtinApplication.noticias_fetch] Started new transaction "18439907"
              Hibernate: select count(*) as y0_ from public.noticia this_
              Hibernate: select this_.idnoticia as idnoticia6_0_, this_.titulo as titulo6_0_, this_.descripcion as descripc3_6_0_, this_.texto as texto6_0_, this_.fecha as fecha6_0_, this_.link as link6_0_, this_.imagen as imagen6_0_, this_.idtema as idtema6_0_, this_.file as file6_0_, this_.fechainicio as fechain10_6_0_, this_.fechafin as fechafin6_0_, this_.resumen as resumen6_0_, this_.autorizado as autorizado6_0_, this_.campo1 as campo14_6_0_, this_.campo2 as campo15_6_0_ from public.noticia this_ limit ?
              === 2011-09-16 16:29:42,981 [0-21] INFO  DSResponse - [builtinApplication.noticias_fetch] DSResponse: List with 75 items
              === 2011-09-16 16:29:42,981 [0-21] INFO  HibernateTransaction - [builtinApplication.noticias_fetch] Attempting to commit 0 database update(s)
              === 2011-09-16 16:29:42,981 [0-21] DEBUG HibernateTransaction - [builtinApplication.noticias_fetch] Committing transaction "18439907"
              === 2011-09-16 16:29:42,996 [0-21] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2011-09-16 16:29:42,996 [0-21] DEBUG RPCManager - non-DMI response, dropExtraFields: false
              === 2011-09-16 16:29:42,996 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              ...
              ...
              ...
              === 2011-09-16 16:29:43,262 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,231 [0-26] DEBUG XML - Parsed XML from (in memory stream): 16ms
              === 2011-09-16 16:29:43,262 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,262 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,262 [0-24] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                      __gwt_ObjectId:342
                  },
                  operationConfig:{
                      dataSource:"imagenes",
                      operationType:"fetch",
                      textMatchStyle:"startsWith"
                  },
                  startRow:0,
                  endRow:75,
                  sortBy:[
                      "fileName"
                  ],
                  componentId:"isc_PickListMenu_1",
                  appID:"builtinApplication",
                  operation:"imagenes_fetch",
                  oldValues:{
                      __gwt_ObjectId:342
                  }
              }
              === 2011-09-16 16:29:43,262 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,262 [0-25] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                      __gwt_ObjectId:340
                  },
                  operationConfig:{
                      dataSource:"temas",
                      operationType:"fetch",
                      textMatchStyle:"startsWith"
                  },
                  startRow:0,
                  endRow:75,
                  sortBy:[
                      "nombre"
                  ],
                  componentId:"isc_PickListMenu_0",
                  appID:"builtinApplication",
                  operation:"temas_fetch",
                  oldValues:{
                      __gwt_ObjectId:340
                  }
              }
              === 2011-09-16 16:29:43,262 [0-25] INFO  IDACall - Performing 1 operation(s)
              === 2011-09-16 16:29:43,262 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,262 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,262 [0-24] INFO  IDACall - Performing 1 operation(s)
              === 2011-09-16 16:29:43,262 [0-26] DEBUG RPCManager - Processing 1 requests.
              === 2011-09-16 16:29:43,262 [0-24] DEBUG AppBase - [builtinApplication.imagenes_fetch] No userTypes defined, allowing anyone access to all operations for this application
              === 2011-09-16 16:29:43,262 [0-24] DEBUG AppBase - [builtinApplication.imagenes_fetch] No public zero-argument method named '_imagenes_fetch' found, performing generic datasource operation
              === 2011-09-16 16:29:43,262 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,262 [0-25] DEBUG AppBase - [builtinApplication.temas_fetch] No userTypes defined, allowing anyone access to all operations for this application
              === 2011-09-16 16:29:43,278 [0-25] DEBUG AppBase - [builtinApplication.temas_fetch] No public zero-argument method named '_temas_fetch' found, performing generic datasource operation
              === 2011-09-16 16:29:43,278 [0-25] INFO  HibernateDataSource - [builtinApplication.temas_fetch] Performing fetch operation with
              	criteria: {__gwt_ObjectId:340}	values: {__gwt_ObjectId:340}
              === 2011-09-16 16:29:43,262 [0-26] DEBUG RPCManager - Request #1 (DSRequest) payload: {
                  criteria:{
                      __gwt_ObjectId:344
                  },
                  operationConfig:{
                      dataSource:"ficheros",
                      operationType:"fetch",
                      textMatchStyle:"startsWith"
                  },
                  startRow:0,
                  endRow:75,
                  componentId:"isc_PickListMenu_2",
                  appID:"builtinApplication",
                  operation:"ficheros_fetch",
                  oldValues:{
                      __gwt_ObjectId:344
                  }
              }
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,278 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,278 [0-25] DEBUG HibernateTransaction - [builtinApplication.temas_fetch] Started new transaction "23233030"
              === 2011-09-16 16:29:43,278 [0-26] INFO  IDACall - Performing 1 operation(s)
              === 2011-09-16 16:29:43,278 [0-25] WARN  HibernateTransaction - [builtinApplication.temas_fetch] Rolling back 0 database update(s)
              === 2011-09-16 16:29:43,278 [0-25] DEBUG HibernateTransaction - [builtinApplication.temas_fetch] Rolling back transaction "23233030"
              === 2011-09-16 16:29:43,293 [0-26] DEBUG AppBase - [builtinApplication.ficheros_fetch] No userTypes defined, allowing anyone access to all operations for this application
              === 2011-09-16 16:29:43,293 [0-26] DEBUG AppBase - [builtinApplication.ficheros_fetch] No public zero-argument method named '_ficheros_fetch' found, performing generic datasource operation
              === 2011-09-16 16:29:43,293 [0-25] WARN  RequestContext - dsRequest.execute() failed: 
              java.lang.NullPointerException
              	at com.isomorphic.hibernate.HibernateDataSource.castValue(HibernateDataSource.java:1830)
              	at com.isomorphic.hibernate.HibernateDataSource.buildCriteria(HibernateDataSource.java:1077)
              	at com.isomorphic.hibernate.HibernateDataSource.processRequest(HibernateDataSource.java:781)
              	at com.isomorphic.hibernate.HibernateDataSource.executeFetch(HibernateDataSource.java:491)
              	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1154)
              	at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:721)
              	at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658)
              	at com.isomorphic.application.AppBase.execute(AppBase.java:491)
              	at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:1653)
              	at com.isomorphic.servlet.IDACall.handleDSRequest(IDACall.java:199)
              	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:156)
              	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:121)
              	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:73)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
              	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
              	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
              	at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
              	at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:362)
              	at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
              	at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
              	at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:729)
              	at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:405)
              	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
              	at org.mortbay.jetty.handler.RequestLogHandler.handle(RequestLogHandler.java:49)
              	at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
              	at org.mortbay.jetty.Server.handle(Server.java:324)
              	at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:505)
              	at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:843)
              	at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:647)
              	at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:211)
              	at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:380)
              	at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:395)
              	at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:488)
              === 2011-09-16 16:29:43,293 [0-25] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
              === 2011-09-16 16:29:43,293 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
              === 2011-09-16 16:29:43,293 [0-21] DEBUG HibernateTransaction - Closing session "18439907"
              === 2011-09-16 16:29:43,293 [0-21] DEBUG HibernateTransaction - Removed transaction "18439907"
              === 2011-09-16 16:29:43,293 [0-25] DEBUG RPCManager - non-DMI response, dropExtraFields: false
              === 2011-09-16 16:29:43,293 [0-25] DEBUG HibernateTransaction - Closing session "23233030"
              === 2011-09-16 16:29:43,293 [0-25] DEBUG HibernateTransaction - Removed transaction "23233030"
              === 2011-09-16 16:29:43,871 [0-26] INFO  DSResponse - [builtinApplication.ficheros_fetch] DSResponse: List with 27 items
              === 2011-09-16 16:29:43,871 [0-26] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2011-09-16 16:29:43,871 [0-26] DEBUG RPCManager - non-DMI response, dropExtraFields: false
              === 2011-09-16 16:29:53,403 [0-24] INFO  DSResponse - [builtinApplication.imagenes_fetch] DSResponse: List with 986 items
              === 2011-09-16 16:29:53,403 [0-24] DEBUG RPCManager - Content type for RPC transaction: text/plain; charset=UTF-8
              === 2011-09-16 16:29:53,418 [0-24] DEBUG RPCManager - non-DMI response, dropExtraFields: false
              regards, Bo

              Comment


                #8
                If the getter is getIdCanal, the JXPath segment should be idCanal not idcanal.

                Comment


                  #9
                  The getter is getIdcanal() (I know it's not correct CamelCase)

                  Comment


                    #10
                    Are you doing this in Power edition or just Pro?

                    valueXPath will cause eager fetching in Power so that Hibernate does an efficient join and the data is already loaded when the XPath is executed. In Pro, you would need to handle this yourself, and if the data was not eagerly fetched, exceptions could result.

                    Comment


                      #11
                      In Noticia.hbm.xml I have the following defintion:
                      Code:
                      <many-to-one name="tema" column="idtema" class="es.myapp.om.Tema" lazy="false"></many-to-one>
                      and in Tema.hbm.xml:
                      Code:
                       <many-to-one name="canal" column="idcanal" class="es.myapp.om.Canal" lazy="false"></many-to-one>
                      So the related objects are actually eagerly fetched.

                      Any other ideas?

                      Comment


                        #12
                        In your server logs, the errors actually start before any kind of multi-segment XPaths are evaluated..

                        Code:
                        === 2011-09-16 16:29:42,996 [0-21] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                        ...
                        ...
                        ...
                        .. but you've cut off the stack trace. So what happened here? If your code is throwing errors for this field, it may have put itself in a state where the series of getters noticia.getTema().getCanal().getIdcanal() is not working any more.

                        One way to test this would be to reorder the fields so that the multi-segment XPath field comes first.

                        Comment


                          #13
                          By the way to clarify the comment about Pro vs Power, the feature of automatically generated joins is actually a 3.x feature, not related to this discussion (and configured with different properties).

                          Comment


                            #14
                            Hi,

                            the part I left out in the dtacktrace is a repetition of the same errors, here's a part of it:
                            Code:
                            === 2011-09-28 19:00:22,150 [l0-4] DEBUG RPCManager - non-DMI response, dropExtraFields: false
                            === 2011-09-28 19:00:22,150 [l0-4] DEBUG HibernateTransaction - Closing session "8487003"
                            === 2011-09-28 19:00:22,150 [l0-4] DEBUG HibernateTransaction - Removed transaction "8487003"
                            === 2011-09-28 19:00:22,150 [l0-5] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] INFO  DataSource - Couldn't get value at valueXPath: tema/canal/idcanal for datasource: noticias - ignoring.  Actual error: org.apache.commons.jxpath.JXPathNotFoundException: No value for xpath: tema/canal/idcanal
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            === 2011-09-28 19:00:22,150 [l0-5] WARN  DataSource - Couldn't get value for property 'idtema' for datasource 'noticias' - ignoring. Actual error: java.lang.NullPointerException
                            This is of when I put the valueXPath field first in the datasource definition:
                            Code:
                            <DataSource ID="noticias" serverType="hibernate" tableName="noticia"
                            	autoDeriveSchema="true" >
                            
                            	<fields>
                            		<field name="idcanal" title="Canal" type="integer" valueXPath="tema/canal/idcanal"  />
                            		<field name="idnoticia" hidden="true" />
                            		<field name="titulo" type="text"/>
                            		<field name="idtema" title="Tema" type="integer" foreignKey="temas.idtema"  />
                            		<field name="campo1" type="text" hidden="true"/>
                            		<field name="campo2" type="text" hidden="true"/>
                            	</fields>
                            
                            </DataSource>
                            Intersting enough, the popup window with the error message mentions temas_fetch, not noticias_fetch:
                            "Server returned FAILURE with no error message performing operation "temas_fetch""

                            cheers

                            Comment


                              #15
                              Code:
                              Intersting enough, the popup window with the error message mentions temas_fetch, not noticias_fetch:
                              "Server returned FAILURE with no error message performing operation "temas_fetch""
                              This seems to have to do with another field, and has got nothing to do with this thread..

                              Comment

                              Working...
                              X