facebook

Stale data during fetch

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #280231 Reply

    singaraju
    Member

    This message has not been recovered.

    #280314 Reply

    Riyad Kalla
    Member

    This message has not been recovered.

    #280419 Reply

    singaraju
    Member

    Riyad,
    Thanks for the response.

    Application changing the data in MySQL is a from the one that is reading the data. So, if I read it right, the second option of moving the code to change into Hibernate is not possible.

    I tried the following and still get stale data. Let me know if this is the right way to close the session.
    AccountInfoDAO dao = new AccountInfoDAO();
    Session session = dao.getSession();
    db_list = dao.findByPhoneNumber(phoneNumber);
    session.close();
    In Accountinfo.hbm.xml, I set the caching option read-write. Is this how you turn-off Level 2 caching?
    <hibernate-mapping>
    <class name=”com.comcast.hibernate.AccountInfo” table=”account_info” catalog=”comcast”>
    <cache usage=”read-write” />

    Thanks in advance.

    -Srini

    #280460 Reply

    Riyad Kalla
    Member

    Srini,
    I looked a few places and am not sure exactly why Hibernate isn’t requerying the database in this case. From what I know about Hibernate you seem to be doing everything right.

    YOu *could* try asking your question at the Hibernate forums… maybe one of the gurus have a better idea than I do.

    #280807 Reply

    singaraju
    Member

    No idea why, but when I switched to use JNDI it seems to refresh the data. I will continue using JNDI for now 🙂

    #280824 Reply

    Riyad Kalla
    Member

    Hmm… well I’m surely glad it’s working better now, but now sure why Hibernate is behaving differenlyt with JNDI than it was the direct JDBC data source.

    Oh well, code-gremlins 😉

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Stale data during fetch

You must be logged in to post in the forum log in