findByPrimaryKey reads non-existent data! - Weblogic

This is a discussion on findByPrimaryKey reads non-existent data! - Weblogic ; Hi, I have a piece of code that executes a findbyprimarykey method to test if a entry exists in the database, if a objectnotfoundexception is thrown it then tries to create add a row using create() method. However in this ...

+ Reply to Thread
Results 1 to 5 of 5

Thread: findByPrimaryKey reads non-existent data!

  1. findByPrimaryKey reads non-existent data!

    Hi,

    I have a piece of code that executes a findbyprimarykey method to test if a entry exists in the database, if a objectnotfoundexception is thrown it then tries to create add a row using create() method.

    However in this particular case no data for the given primary key exists in the db, yet the find method does not throw a objectnotfoundexception.

    Later on in code when I try to access any field from this bean a Nosuchentityexception is throws!

    Is this a bug?

  2. Re: findByPrimaryKey reads non-existent data!

    BMP or CMP?

    -- Rob

    Nilesh Kale wrote:
    > Hi,
    >
    > I have a piece of code that executes a findbyprimarykey method to test if a entry exists in the database, if a objectnotfoundexception is thrown it then tries to create add a row using create() method.
    >
    > However in this particular case no data for the given primary key exists in the db, yet the find method does not throw a objectnotfoundexception.
    >
    > Later on in code when I try to access any field from this bean a Nosuchentityexception is throws!
    >
    > Is this a bug?



  3. Re: findByPrimaryKey reads non-existent data!


    Hi Rob,

    CMP - running on WLS 8.1 SP1

    Regards
    Nilesh
    Rob Woollen wrote:
    >BMP or CMP?
    >
    >-- Rob
    >
    >Nilesh Kale wrote:
    >> Hi,
    >>
    >> I have a piece of code that executes a findbyprimarykey method to test

    >if a entry exists in the database, if a objectnotfoundexception is thrown
    >it then tries to create add a row using create() method.
    >>
    >> However in this particular case no data for the given primary key exists

    >in the db, yet the find method does not throw a objectnotfoundexception.
    >
    >>
    >> Later on in code when I try to access any field from this bean a Nosuchentityexception

    >is throws!
    >>
    >> Is this a bug?

    >



  4. Re: findByPrimaryKey reads non-existent data!

    The best way for us to solve this is for you to provide as much
    information as possible. Basically we need to see when transactions are
    started, what methods you call, what callbacks are made on the bean, and
    what SQL is issued.

    I would first check if the findByPrimaryKey call that you believe should
    fail actually issues any SQL or whether it is only hitting the EJB's cache.

    Also, do you have cache-between-transactions set to true?

    -- Rob


    Nilesh Kale wrote:
    > Hi Rob,
    >
    > CMP - running on WLS 8.1 SP1
    >
    > Regards
    > Nilesh
    > Rob Woollen wrote:
    >
    >>BMP or CMP?
    >>
    >>-- Rob
    >>
    >>Nilesh Kale wrote:
    >>
    >>>Hi,
    >>>
    >>>I have a piece of code that executes a findbyprimarykey method to test

    >>
    >>if a entry exists in the database, if a objectnotfoundexception is thrown
    >>it then tries to create add a row using create() method.
    >>
    >>>However in this particular case no data for the given primary key exists

    >>
    >>in the db, yet the find method does not throw a objectnotfoundexception.
    >>
    >>
    >>>Later on in code when I try to access any field from this bean a Nosuchentityexception

    >>
    >>is throws!
    >>
    >>>Is this a bug?

    >>

    >



  5. Re: findByPrimaryKey reads non-existent data!


    The cache-between-transaction is not specifed at all in the descriptors. We are
    using xdoclet to generate the ebj's and descriptors.

    Will test if the findbyPK hits the database using P6SPY and let you know.

    Rob Woollen wrote:
    >The best way for us to solve this is for you to provide as much
    >information as possible. Basically we need to see when transactions
    >are
    >started, what methods you call, what callbacks are made on the bean,
    >and
    >what SQL is issued.
    >
    >I would first check if the findByPrimaryKey call that you believe should
    >
    >fail actually issues any SQL or whether it is only hitting the EJB's
    >cache.
    >
    >Also, do you have cache-between-transactions set to true?
    >
    >-- Rob
    >
    >
    >Nilesh Kale wrote:
    >> Hi Rob,
    >>
    >> CMP - running on WLS 8.1 SP1
    >>
    >> Regards
    >> Nilesh
    >> Rob Woollen wrote:
    >>
    >>>BMP or CMP?
    >>>
    >>>-- Rob
    >>>
    >>>Nilesh Kale wrote:
    >>>
    >>>>Hi,
    >>>>
    >>>>I have a piece of code that executes a findbyprimarykey method to

    >test
    >>>
    >>>if a entry exists in the database, if a objectnotfoundexception is

    >thrown
    >>>it then tries to create add a row using create() method.
    >>>
    >>>>However in this particular case no data for the given primary key

    >exists
    >>>
    >>>in the db, yet the find method does not throw a objectnotfoundexception.
    >>>
    >>>
    >>>>Later on in code when I try to access any field from this bean a Nosuchentityexception
    >>>
    >>>is throws!
    >>>
    >>>>Is this a bug?
    >>>

    >>

    >



+ Reply to Thread