facebook

Can’t see DB-Changes…..

  1. MyEclipse IDE
  2.  > 
  3. Off Topic
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #261348 Reply

    danielkohl
    Participant

    Hi all,

    my application uses only one session object who is always connected to the underlying DB (MySQL).
    Unfortunately i alway see the current snapshot of data. If the data changes during runtime i can’t see them.
    The changes only become visible after a restart of my application or new instantiation of my session object.

    What can i do to become up-to-date during runtime?

    I think taht it’s very easy, but i am not that professional in Databases 🙂

    Thanks in advance

    Daniel

    #261353 Reply

    Haris Peco
    Member

    Daniel,

    Try check preference ‘Auto commit’ to on ( Windows>Preferences>MyEclipse>Database Explorer)

    Regards,

    #261357 Reply

    danielkohl
    Participant

    ouuupss…sorry….i did forget to mention that this is not a DB-Explorer proplem.

    In MY application, using Java 5 and Hibernate 3, i can’t see changes during runtime.
    What can i do in Hibernate?

    Greetings

    #261358 Reply

    Haris Peco
    Member

    Daniel,

    You have to do your data manipulation in transaction and call commit.

    Example ;

    Session session = null;
    Transaction t = null;
    try {
    session = …;
    t=session.beginTransaction();
    // save or update data
    t.commit();
    } catch (Exception e) {
    if (t!=null)
    t.rollback();
    } finally {
    if (session != null)
    session.close();
    }

    If you use Spring you can use declarative transaction.

    Regards,

    #261463 Reply

    danielkohl
    Participant

    Hi,

    this is exactly what i do, but my session remains open (i do not call close).
    I open the session at the start of my app and i close it on shutdown.
    works really fine, but i can’t see changes made by other clients until i close the session (in my case is a restart necessary to see the changes).

    i would expect that commited data from other sessions directly appear in my session.

    any ideas?

    thanks in advance

    daniel

    #261468 Reply

    Haris Peco
    Member

    You have to see changes after commit (closing session is not important).Check if your commit is successful

    Regards,

Viewing 6 posts - 1 through 6 (of 6 total)
Reply To: Can’t see DB-Changes…..

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