Container returning the incorrect pk after create - Weblogic

This is a discussion on Container returning the incorrect pk after create - Weblogic ; Using SQL Server with WLS 8.1 and automatic pk generation. A call like so: - Long pk = entitybean.create(); ...correctly inserts the row on the database, but the value of pk is the previous value assigned by IDENTITY, not the ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Container returning the incorrect pk after create

  1. Container returning the incorrect pk after create


    Using SQL Server with WLS 8.1 and automatic pk generation. A call like so: -

    Long pk = entitybean.create();

    ...correctly inserts the row on the database, but the value of pk is the previous
    value assigned by IDENTITY, not the value that has just been inserted into the
    database. If the test is run after a server restart, the pk returns 0

    The P6Spy log shows that the select @@IDENTITY is being called BEFORE the SQL
    insert!

    Is my configuration incorrect or is this a bug?

    A pretty serious one I might add!

  2. Re: Container returning the incorrect pk after create

    "Aaron" wrote in message news:3f850cff$1@newsgroups.bea.com...
    >
    > Using SQL Server with WLS 8.1 and automatic pk generation. A call like so: -
    >
    > Long pk = entitybean.create();
    >
    > ..correctly inserts the row on the database, but the value of pk is the previous
    > value assigned by IDENTITY, not the value that has just been inserted into the
    > database. If the test is run after a server restart, the pk returns 0
    >
    > The P6Spy log shows that the select @@IDENTITY is being called BEFORE the SQL
    > insert!
    >
    > Is my configuration incorrect or is this a bug?


    Sounds like a bug. Contact support@bea.com

    Slava



  3. Re: Container returning the incorrect pk after create


    Hi,

    This isn't good.
    As a first stab at it, in the weblogic-cmp-rdbms-jar.xml
    can you verify that the following elements are set:

    False
    False

    If they are not both set to False, can you try setting them, recompiling and
    redeploying the jar/ear and seeing if you still get the same result ?

    let me know what happens.

    thanks

    -thorick

  4. Re: Container returning the incorrect pk after create


    Neither of these settings are allowed for automatic-key-generation with a generator-type
    of SQLServer.

    If you try and deploy the bean with these set to true, the container will turn
    them off and you'll get a warning message to that effect.

    "thorick" wrote:
    >
    >Hi,
    >
    >This isn't good.
    >As a first stab at it, in the weblogic-cmp-rdbms-jar.xml
    >can you verify that the following elements are set:
    >
    > False
    > False
    >
    >If they are not both set to False, can you try setting them, recompiling
    >and
    >redeploying the jar/ear and seeing if you still get the same result ?
    >
    >let me know what happens.
    >
    >thanks
    >
    >-thorick



  5. Re: Container returning the incorrect pk after create


    "Aaron" wrote:
    >
    >Neither of these settings are allowed for automatic-key-generation with
    >a generator-type
    >of SQLServer.
    >
    >If you try and deploy the bean with these set to true, the container
    >will turn
    >them off and you'll get a warning message to that effect.
    >
    >"thorick" wrote:



    That sounds right.
    2nd stab, can you boot the server with the properties:

    -Dweblogic.ejb20.cmp.rdbms.codegen.verbose -Dweblogic.ejb20.cmp.rdbms.codegen.debug

    rerun the offending test, look for the output near the failure, post a log entries
    leading
    up to the failure.

    -thorick



  6. Re: Container returning the incorrect pk after create


    "Aaron" wrote:
    >
    >Neither of these settings are allowed for automatic-key-generation with
    >a generator-type
    >of SQLServer.
    >
    >If you try and deploy the bean with these set to true, the container
    >will turn
    >them off and you'll get a warning message to that effect.
    >


    If one tries setting these properties to 'False' anyway, it will likely work.
    Please give this a try.

    -thorick


+ Reply to Thread