6 Replies Latest reply on Jan 28, 2012 12:25 PM by NickAiva

    BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)

    Rommel Pino
      Hello Experts!

      EJB Embedded objects are working well in JDeveloper 11.1.1.1.0, but in the latest JDeveloper 11.1.1.2 PatchSet 1 a NullPointerException is thrown whenever you drop an attribute of the embedded object as part of a form or table:
      Target URL -- http://127.0.0.1:7101/HR_EJB_JPA_App-UserInterface-context-root/faces/employee_list.jspx
      [EL Info]: 2009-12-13 10:12:20.651--ServerSession(808977)--EclipseLink, version: Eclipse Persistence Services - 1.2.0.v20091016-r5565
      [EL Info]: 2009-12-13 10:12:20.651--ServerSession(808977)--Server: WebLogic Server 10.3.2.0  Tue Oct 20 12:16:15 PDT 2009 1267925 
      [EL Info]: 2009-12-13 10:12:20.667--ServerSession(808977)--file:/C:/Documents and Settings/rommel/Application Data/JDeveloper/system11.1.1.2.36.55.36/o.j2ee/drs/HR_EJB_JPA_App/EJBModelEJB.jar/-EJBModel login successful
      <13-Dec-2009 10:12:22 o'clock AST> <Error> <HTTP> <BEA-101020> <[ServletContext@106178[app:HR_EJB_JPA_App module:HR_EJB_JPA_App-UserInterface-context-root path:/HR_EJB_JPA_App-UserInterface-context-root spec-version:2.5]] Servlet failed with Exception
      java.lang.NullPointerException
           at oracle.adf.model.adapter.bean.jpa.JPQLEntity.getAliasName(JPQLEntity.java:248)
           at oracle.adf.model.adapter.bean.jpa.JPQLEntity.initQuery(JPQLEntity.java:122)
           at oracle.adf.model.adapter.bean.jpa.JPQLBeanDataCollection.init(JPQLBeanDataCollection.java:101)
           at oracle.adf.model.adapter.bean.provider.BeanDataCollection.<init>(BeanDataCollection.java:108)
           at oracle.adf.model.adapter.bean.jpa.JPQLBeanDataCollection.<init>(JPQLBeanDataCollection.java:59)
           Truncated. see log file for complete stacktrace
      >
      Below are the steps to reproduce the bug:
      1) Create a new Embeddable class like the Audit class below:
      package oracle;
      
      import java.io.Serializable;
      import javax.persistence.Column;
      import javax.persistence.Embeddable;
      
      @Embeddable
      public class Audit implements Serializable {
          
          @Column(name = "CREATED_BY", nullable = false, length = 60)
          private String createdBy;
       
          public String getCreatedBy() {
              return createdBy;
          }
      
          public void setCreatedBy(String createdBy) {
              this.createdBy = createdBy;
          }
      }
      2) Add a "CREATED_BY" (VARCHAR) field on the employee table of the HR Schema. (Optional) Open an SQL Worksheet in HRConn connection in the Database Navigator and run the following script to fill the new field with data:
      UPDATE "HR"."EMPLOYEES" SET CREATED_BY = 'you'
      3) Add the new Audit class as an attribute of Employess class
      //...
          @Embedded
          private Audit audit;
      
          public Audit getAudit() {
              return audit;
          }
      
          public void setAudit(Audit audit) {
              this.audit = audit;
          }
      ...
      4) Rebuild HRFacadeBean and recreate the Data Control.

      5) Create a new view object "employee_list.jspx" in the faces-config.xml and create the corresponding page.

      6) Drag the employeesFindAll accessor to the page as a read-only table. Delete all the fields except for the following
      <li>employeeId</li>
      <li>lastName</li>
      <li>firstName</li>
      <li>employeeId</li>
      <li>audit.createdBy</li>

      7)Save All

      8)Go to the the faces-config.xml. Right-click the employee_list view and click Run.

      Viola! java.lang.NullPointerException
           at oracle.adf.model.adapter.bean.jpa.JPQLEntity.getAliasName(JPQLEntity.java:248)

      How to resolve this?
      As I noted above this is working in Jdev 11.1.1.1

      regards,

      pino

      Edited by: pino on 12-Dec-2009 23:47
        • 1. Re: BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)
          Sudipto Desmukh
          I too am facing this issue-
          <UIXRegion><_warn> Error processing viewId: /records-order/records-order-ts URI: /records/records-order-ts.jsff actual-URI: /records/records-order-ts.jsff.
          java.lang.NullPointerException
               at oracle.adf.model.adapter.bean.jpa.JPQLEntity.getAliasName(JPQLEntity.java:248)
               at oracle.adf.model.adapter.bean.jpa.JPQLEntity.initQuery(JPQLEntity.java:122)
               at oracle.adf.model.adapter.bean.jpa.JPQLBeanDataCollection.init(JPQLBeanDataCollection.java:101)
               at oracle.adf.model.adapter.bean.provider.BeanDataCollection.<init>(BeanDataCollection.java:108)
               at oracle.adf.model.adapter.bean.jpa.JPQLBeanDataCollection.<init>(JPQLBeanDataCollection.java:59)
               at oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler.invoke(JPQLDataFilterHandler.java:55)
               at oracle.adf.model.adapter.bean.DataFilterHandler.invokeAccessor(DataFilterHandler.java:141)
               at oracle.adf.model.adapter.bean.BeanFilterableDataControl.invokeAccessor(BeanFilterableDataControl.java:78)

          <UIXInclude><tearDownVisitingContext> Tear down of include component context failed due to an unhandled exception.
          java.util.NoSuchElementException
               at java.util.ArrayDeque.removeFirst(ArrayDeque.java:251)
               at java.util.ArrayDeque.pop(ArrayDeque.java:480)
               at oracle.adfinternal.view.faces.context.ApplicationContextManagerImpl.popContextChange(ApplicationContextManagerImpl.java:66)
               at oracle.adf.view.rich.component.fragment.UIXInclude.tearDownVisitingContext(UIXInclude.java:206)
               at oracle.adf.view.rich.component.fragment.UIXPageTemplate.tearDownVisitingContext(UIXPageTemplate.java:248)
               at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.encodeEnd(ContextSwitchingComponent.java:157)


          Can you please suggest what helped you resolve it.
          I think it might be an issue with the EJB-QL somewhere ?

          Thanks
          Sudipto
          • 2. Re: BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)
            Frank Nimphius-Oracle
            Pino,

            did you try JDeveloper 11.1.1.3 ? If this also reproduces on the latest release, please create a test case and send it to me - just in case you can't file a bug yourself. My mail address is in my OTN profile. Make sure the zip file extension is changed to e.g. ".unzipme"

            Frank
            • 3. Re: BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)
              Sudipto Desmukh
              This issue is resolved after removing this line from DataControls.dcx in the EJB based Model project -

              DataControlHandler="oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler"

              from the tag <ejb-definition ejb-version="3.0" ejb-name="OrderService">

              -Sudipto
              • 4. Re: BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)
                797283
                When I remove DataControlHandler="oracle.adf.model.adapter.bean.jpa.JPQLDataFilterHandler"
                from DataControls.dcx,this nullpointer problem is resolved.
                But, the paging funtion not work, the following method in my EJB class not called,
                public Object queryByRange(String jpqlStmt, int firstResult,
                int maxResults)
                Does anyone can help me?
                My jdeveloper is 11.1.1.3.Thanks a lot!
                • 5. Re: BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)
                  virgulino
                  All,
                  I´m facing the same problem.
                  Any suggestion?
                  • 6. Re: BUG! JPQLEntity.getAliasName() NullPointerException (EJB @Embedded Objects)
                    NickAiva
                    Guten Tag!
                    The same error stiil applies for Build JDEVADF_11.1.1.4.0_GENERIC_101227.1736.5923
                    Any news?
                    Vielen Dank!

                    NA