The EntitySpaces Community

Share and learn about the EntitySpaces Architecture.
Welcome to The EntitySpaces Community Sign in | Join | Help
in
Home Forums Photos

Like 1 year ago still get Null Exeception with FillDataSet or FillDataTable from a stored procedure

Last post 07-29-2008, 3:04 PM by David.Parsons. 1 replies.
Sort Posts: Previous Next
  •  07-29-2008, 12:06 PM 10416

    Like 1 year ago still get Null Exeception with FillDataSet or FillDataTable from a stored procedure

    I am evaluating EntitySpaces and trying to get it to work with Oracle (the way it is used here). I have already customized the stored procedure / metadata templates creating and calling to generate "CRUD" code that works (inside of oracle packages). Hard but I got it working.

    I am now hung up on trying to fill a dataset set from a custom stored procedure. I get the same error if the stored procedure is in a package or not in a package.

    - Object reference not set to an instance of an object.
    - at EntitySpaces.OracleClientProvider.DataProvider.EntitySpaces.Interfaces.IDataProvider.FillDataSet(esDataRequest request)
      at EntitySpaces.Interfaces.esDataProvider.FillDataSet(esDataRequest request, esProviderSignature sig)
      at EntitySpaces.Core.esEntityCollection.FillDataSet(esQueryType queryType, String query, esParameters parms)
      at EntitySpaces.Core.esUtility.FillDataSet(esQueryType queryType, String query, esParameters parms)
      at BusinessObjects.UserProfileCollection.LoadCustomTest(String pUserId) 
      in c:\Source\Webroot\WamReportSite\App_Code\Custom\UserProfileCollection.vb:line 42

    I saw this same error in another post from summer of 2007 and it never really said how to fix it or get around it (at least not that I understood) and that it would be fixed in a newer version. I assume the error was passing in the parameter directly (which I am not doing). The other link is to the same question, left unanswered.

    http://community.entityspaces.net/forums/thread/3076.aspx
    http://community.entityspaces.net/forums/thread/7844.aspx

    Any help you can give me would be appreciated. Below are the details of my install. With the Oracle table (very simple) and the generated load taken out of the package (although it does refer back to the package for the REF CURSOR type definition). I was just trying to make this the example as simple as posible.
    As stated above. I can access this stored procedure through the standard "CRUD" code, using load on the object without error.

    I am using VS 2008, EntitySpaces 2008, Oracle 10g, MyGeneration 1.2. Generated WITHOUT catalog or schema.

    Code:
    CREATE TABLE aec_user_profile
        (user_id                        VARCHAR2(50) NOT NULL,
        report_display_checks          NUMBER(1,0) NOT NULL)
      PCTFREE     10
      INITRANS    1
      MAXTRANS    255
      TABLESPACE  teg_data
      STORAGE   (
        INITIAL     65536
        MINEXTENTS  1
        MAXEXTENTS  2147483645
      )
    /
    
    ALTER TABLE aec_user_profile
    ADD CONSTRAINT pk_aec_user_profile PRIMARY KEY (user_id)
    USING INDEX
      PCTFREE     10
      INITRANS    2
      MAXTRANS    255
      TABLESPACE  teg_data
      STORAGE   (
        INITIAL     65536
        MINEXTENTS  1
        MAXEXTENTS  2147483645
      )
    /
    
    PROCEDURE "LoadByPrimaryKey"
      (
    	pUSER_ID IN "AEC_USER_PROFILE"."USER_ID"%type,
    	outCursor OUT SPCKG_AEC_USER_PROFILE_GEN.t_cursor
      )
       IS
      BEGIN
        OPEN outCursor FOR
    	SELECT
    		"USER_ID", 
    		"REPORT_DISPLAY_CHECKS"
    	FROM "AEC_USER_PROFILE"
    	WHERE
    		"USER_ID" = pUSER_ID;
      END;
      
    Code:
    Dim oEsU As New esUtility
    Dim oParams As New esParameters
    oParams.Add("pUSER_ID", 1, esParameterDirection.Input, DbType.String, 50)
    Dim ds As DataSet = oEsU.FillDataSet(esQueryType.StoredProcedure, "LoadByPrimaryKey", oParams)

     

  •  07-29-2008, 3:04 PM 10420 in reply to 10416

    Re: Like 1 year ago still get Null Exeception with FillDataSet or FillDataTable from a stored procedure

    There are a couple of things.

    • Unfortunately, you chose LoadByPrimaryKey as your test procedure. EntitySpaces tacks on the "p" prefix inside the Oracle provider for our CRUD SPs, so you are going to end up with "ppUSER_ID", which is not a valid input parameter.
    • Not shown in intellisense, but mentioned in the EntitySpaces API chm for the "EntitySpaces.Interfaces -> esParameter" class, is that the overload below should be used for Input parameters. All the other overloads are for non-input parameters only.
    • The data type is picked up from the parameter value. Since it appears to be a VARCHAR2, you should pass in a string.

    See if this works for you:

    Code:
    oParams.Add("USER_ID", "1")

    As far as the null reference exception, we tried to go through and clean that up, but it looks like we missed FillDataTable and FillDataSet. We'll get the following fix in the next maintenance release:

    esDataResponse response = null;

    should be:

    esDataResponse response = new esDataResponse();

    With the extra "p" on the parameter, this is the exception that would be thrown:

    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to
      'esAggregateTestLoadByPK'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored


    David Neal Parsons
    www.entityspaces.net
View as RSS news feed in XML