-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: refresh() does not work
PostPosted: Sat Apr 03, 2010 8:45 am 
Beginner
Beginner

Joined: Wed Mar 03, 2010 4:06 am
Posts: 21
Hi,

I'am using a simple dialog that implements CRUD-functionality on one single entity. If only one user works with the datebase (mysql) there is no problem but multi-user environment is a big problem. If another user changes data the fist one doesn't see the changing. I can't believe why hibernate doesn't refresh the data. Before showing it to the user. I'm creating a new Session (HibernateDAOFactory instantiate...(xxx.class)) and start a new transaction. I even tried so run dao.getSession().refresh(e) for every result of the received list from the findByCriteria(). Only if I completely reconnect to the database which means closing / starting the program shows up the "correct" data from the database. Does anybody know the reason for thus behaviour? Any hint would by nice. Thanks a lot.

Jonny


Top
 Profile  
 
 Post subject: Re: refresh() does not work
PostPosted: Sat Apr 03, 2010 10:39 am 
Beginner
Beginner

Joined: Wed Mar 03, 2010 4:06 am
Posts: 21
Hi,

I am totally frustrated. I can't understand what's happening there. Even if I use

Code:
      HibernateUtil.shutdown();
      org.hibernate.Session s = HibernateUtil.getSessionFactory().getCurrentSession();
      
      s.beginTransaction();

      Criteria crit = s.createCriteria(Rooms.class);
      List<Zimmer> res = new LinkedList<Rooms>();
      res = crit.list();
      for (Room r : res) {
         s.refresh(r);
      }
      s.close();
      return res;


I'll get the f.... wrong (not current) data from the db. I also disabled the 2nd level cache. I don't know what to do. PLEASE any hint may help. THANKS

Jonny


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.