Parameter values are not in correct order in generated SQL

4 posts, 0 answers
  1. Omar
    Omar avatar
    5 posts
    Member since:
    May 2009

    Posted 22 Jun 2011 Link to this post

    Hello,
    I have a table POSEL with two primary keys (PSL_ID, PSS,ID) and 1..* relationship with another table PSL_OSEBA with the keys (ID_PP, OSV_ID, PSL_ID, PSS_ID).

    I was testing the disconnected environment ObjectScope with the following simple implementation
     
    var posel = DB.POSELs.First(p => p.PSL_ID == pslId && p.PSS_ID == pssId);
    container.CopyFrom(GetInternalScope(), "Posel", posel, null)
    var pn = container.NamedList<DALC.POSEL>("Posel");
    container.Transaction.Begin();
    pn.First().NAZIV = "new";
    container.Transaction.Commit();
    container.CopyTo(GetInternalScope(), ObjectContainer.Verify.All);

    when the debugger hits the statement container.CopyTo it throws an exception that the row was not found
    Telerik.OpenAccess.Exceptions.NoSuchObjectException: No row for DALC.PSL_OSEBA ('PSL_OSEBA') GenericOID@bb9435aa PSL_OSEBA PSL_ID=930661/OSV_ID=DOL/ID_PP=4000008/PSS_ID=1 NOTRES

    The thing i noticed was that the values for the query parameters are not correct, they are mixed
    the correct order should be PSL_ID=4000008/OSV_ID=DOL/ID_PP=930661/PSS_ID=1


    The log file showed this
    Telerik.OpenAccess Information: 84 : sm.fetch                   DALC.POSEL 4000008, 1 [-retrieveReferencesHollow] 0 state(s)<br>
    Telerik.OpenAccess Information: 85 : driver.pool.alloc          1 active=1/10 idle=1/10 con=-842352755<br>
    .....<br>
    Telerik.OpenAccess Information: 88 : driver.stat.execQuery      -842352755 SELECT "PSL_ID" COL1, "OSV_ID" COL2, "ID_PP" COL3, "PSS_ID" COL4 FROM "PSL_OSEBA" WHERE "PSL_ID" = ?                       AND "PSS_ID" = ?                       <br>
    .....<br>
    Telerik.OpenAccess Information: 95 : driver.con.commit          -842352755 <br>
    Telerik.OpenAccess Information: 96 : driver.con.rollback        -842352755 <br>
    Telerik.OpenAccess Information: 97 : driver.pool.release        1 active=0/10 idle=2/10 con=-842352755<br>
    .......<br>
    Telerik.OpenAccess Information: 104 : sm.fetch                   DALC.PSL_OSEBA 930661, DOL, 4000008, 1 [-jdoGenieRetrieveFG, -jdoreq] 0 state(s)<br>
    Telerik.OpenAccess Information: 105 : driver.pool.alloc          1 active=1/10 idle=1/10 con=-842352755<br>
    Telerik.OpenAccess Information: 106 : driver.stat.execQuery      -842352755 SELECT a."ID_PP" COL1, a."ID_PSL_OSEBA" COL2, ....... FROM "PSL_OSEBA" a LEFT JOIN "POSEL" b ON (a."PSL_ID" = b."PSL_ID" and a."PSS_ID" = b."PSS_ID") WHERE a."PSL_ID" = ?                       AND a."OSV_ID" = ?                       AND a."ID_PP" = ?                       AND a."PSS_ID" = ?                       <br>
    Telerik.OpenAccess Information: 107 : driver.con.commit          -842352755 <br>
    Telerik.OpenAccess Information: 108 : driver.con.rollback        -842352755 <br>
    Telerik.OpenAccess Information: 109 : driver.pool.release        1 active=0/10 idle=2/10 con=-842352755<br>
    Telerik.OpenAccess Error: 104 : Telerik.OpenAccess.Exceptions.NoSuchObjectException: No row for DALC.PSL_OSEBA ('PSL_OSEBA') GenericOID@bb9435aa PSL_OSEBA PSL_ID=930661/OSV_ID=DOL/ID_PP=4000008/PSS_ID=1 NOTRES <br>
    A first chance exception of type 'Telerik.OpenAccess.Exceptions.NoSuchObjectException' occurred in Telerik.OpenAccess.dll


    Thank you for your help.
    Omar



  2. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 27 Jun 2011 Link to this post

    Hello Omar,
    I have tried to reproduce your problem, the test application is attached. Are you doing anything different?

    Greetings,
    Jan Blessenohl
    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
  3. DevCraft banner
  4. Omar
    Omar avatar
    5 posts
    Member since:
    May 2009

    Posted 27 Jun 2011 Link to this post

    Hi again, 

    The column types are not correct, they are not numbers like in the sample application where you run your tests.

    Sorry i didnt give you the complete information to reproduce that bug, here are the column types as on the Oracle Database.
    - Database : Oracle 11g
    - column types are 
    -- PSL_ID CHAR(7)
    -- PSS_ID NUMBER
    -- OSV_ID CHAR(3)
    -- ID_PP VARCHAR2(10)

    The reason for that these columns are defined like this is that its a database for an application that has been running for years, and we are considering using OpenAccess for a new application that will use the same Database, we are trying to evaluate what changes should we carry out on the database to be able to use OpenAccess
  5. Jan Blessenohl
    Admin
    Jan Blessenohl avatar
    707 posts

    Posted 27 Jun 2011 Link to this post

    Hello Omar,
    Can you just send me your database schema or a ddl script that I can work with? Usually your scenario should work, OpenAccess tries to support as many lagacy databases as possible.

    All the best,
    Jan Blessenohl
    the Telerik team
    Q1’11 SP1 of Telerik OpenAccess is available for download; also available is the Q2'11 Roadmap for Telerik OpenAccess ORM.
Back to Top