Announcement

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

    JPA2 DataSource exception

    Hi,

    during fetch operation on JPA2DataSource I receive an exception for some datasources.

    I declared the DS as
    Code:
    <DataSource ID="branchesDS"
            serverConstructor="com.isomorphic.jpa.JPA2DataSource"   
            beanClassName="cz.bcom.smartrise.server.persistence.hibernate.LocCitybranches"
            dropExtraFields="true">
    fetch method in DMI is
    Code:
    public DSResponse fetch(DSRequest dsRequest) throws Exception {
      return dsRequest.execute();
    };
    Code:
    java.lang.NullPointerException
    	at org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:396)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3671)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3452)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3325)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:733)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:584)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:301)
    	at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:244)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:254)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:185)
    	at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:136)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:101)
    	at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:80)
    	at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:124)
    	at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:156)
    	at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:135)
    	at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1770)
    	at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:272)
    	at com.isomorphic.jpa.JPADataSource.executeFetch(JPADataSource.java:722)
    	at com.isomorphic.datasource.DataSource.execute(DataSource.java:1195)
    	at com.isomorphic.jpa.JPADataSource.execute(JPADataSource.java:409)
    	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:1881)
    	at cz.bcom.smartrise.server.persistence.dmi.BranchesDMI.fetch(BranchesDMI.java:52)
    What did I do wrong?

    best regards,
    Zdary

    #2
    You forgot to post the complete server log for the request, As well as version information.

    Comment


      #3
      Hi,

      I'm sorry for that.

      I retested this on SmartGWT 3.0 23-10.2011
      I uploaded all logs I have.
      Eclipse system out http://www.zdary.cz/sysout.txt
      Eclipse development mode http://www.zdary.cz/developmentmode.txt
      Developer consove log http://www.zdary.cz/developerconsole.txt

      best regards,
      Zdary

      Comment


        #4
        Hi,

        have I provided enough information for you?

        best regards,
        Zdary

        Comment


          #5
          Hi,

          Can you post complete data source definitions?

          Judging from query string: you have relations to other data sources - please post them as well.

          Regards,
          Alius

          Comment


            #6
            Hi Alius,

            please find, complete DS definitions on www.zdary.cz/ds.zip
            The DS in question is branchesDS.ds.xml

            best regards,
            Zdary

            Comment


              #7
              Hi,

              It is not SmartClient error. Generated HQL query is correct and exception is thrown from Hibernate's code:
              Code:
              fromElement = dot.getImpliedJoin(); // Line 395
              fromElement.setAllPropertyFetch( propertyFetch != null ); // line 396  <-- exception is here
              You should check relation definition between entities at JPA level. For example:
              you have valueXPath="dataFlagsets/BMobileServiceAdvisor/locFlags/name"
              This means that "LocCitybranches" entity has to have property "dataFlagsets" of type (I guess) "Flagsets".
              "Flagsets" has to be mapped entity and have property "BMobileServiceAdvisor" of type (guessing again) "MobileServiceAdvisor".
              "MobileServiceAdvisor" has to be mapped entity and has property "locFlags" of type (guessing) "Flags".
              "Flags" has to have property "name".

              For this one setting you have to have these mapped entities with defined relations at JPA level:
              LocCitybranches
              Flagsets
              MobileServiceAdvisor
              Flags

              You have to check all relations.

              I would suggest to leave only one field with valueXPath setting. Comment out all others to narrow your search. If request fails - check for relations.

              Best regards,
              Alius

              Comment

              Working...
              X