Revision: 3516
Author: seba.wagner
Date: Tue Oct 26 08:36:27 2010
Log: Should fix to make permanent sessions
http://code.google.com/p/openmeetings/source/detail?r=3516

Modified:
/trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/Sessionmanagement.java

=======================================
--- /trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/Sessionmanagement.java Fri Aug 20 03:54:00 2010 +++ /trunk/singlewebapp/src/app/org/openmeetings/app/data/basic/Sessionmanagement.java Tue Oct 26 08:36:27 2010
@@ -536,18 +536,40 @@
         * @param date
         * @return
         */
-       private List getSessionToDelete(Date date){
+       private List<Sessiondata> getSessionToDelete(Date refresh_time){
                try {
                        //log.debug("****** sessionToDelete: "+date);
+//                     Object idf = HibernateUtil.createSession();
+//                     Session session = HibernateUtil.getSession();
+//                     Transaction tx = session.beginTransaction();
+// Criteria crit = session.createCriteria(Sessiondata.class, ScopeApplicationAdapter.webAppRootKey);
+//                     crit.add(Restrictions.lt("refresh_time", date));
+//                     List fullList = crit.list();
+//                     tx.commit();
+//                     HibernateUtil.closeSession(idf);
+//                     return fullList;
+
+                       String hql = "Select c from Sessiondata c " +
+                                                       "WHERE c.refresh_time < 
:refresh_time " +
+                                                       "AND ( " +
+                                                       "c.storePermanent IS NULL 
" +
+                                                       "OR " +
+                                                       "c.storePermanent = false 
" +
+                                                       ")";
+
                        Object idf = HibernateUtil.createSession();
                        Session session = HibernateUtil.getSession();
                        Transaction tx = session.beginTransaction();
- Criteria crit = session.createCriteria(Sessiondata.class, ScopeApplicationAdapter.webAppRootKey);
-                       crit.add(Restrictions.lt("refresh_time", date));
-                       List fullList = crit.list();
+                       Query query = session.createQuery(hql);
+                       query.setDate("refresh_time", refresh_time);
+                       List<Sessiondata> fullList = query.list();
                        tx.commit();
                        HibernateUtil.closeSession(idf);
-                       return fullList;
+
+                       log.debug("Sessions To Delete :: "+fullList.size());
+
+                       return fullList;
+
                } catch (HibernateException ex) {
                        log.error("[getSessionToDelete]: " ,ex);
                } catch (Exception ex2) {

--
You received this message because you are subscribed to the Google Groups 
"OpenMeetings developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/openmeetings-dev?hl=en.

Reply via email to