AnsweredAssumed Answered

hibernate sql queries

Question asked by vinhqchu on Mar 9, 2009
Latest reply on Mar 16, 2009 by vinhqchu
does anyone know how to utilize alfresco's hibernate support to make your own sql calls? I am getting null values for my getHibernateTemplate calls and I am not sure why. I don't think I am making a connection to alfresco's hibernate connection. I am trying to display all spaces allowed for the current user and alfresco doesn't seem to have the api for this. the following is the code I'm trying to execute:

         HibernateCallback callback = new HibernateCallback()
         {
             public Object doInHibernate(Session session)
             {
                 Query query = session.createSQLQuery("select name from org.alfresco.repo.domain.hibernate.DbPermissionImpl");
                 DirtySessionMethodInterceptor.setQueryFlushMode(session, query);
                 return query.uniqueResult();
             }
         };
         Query results2 = (Query) getHibernateTemplate().execute(callback);

Thank in advance for your help,
Vinh

Outcomes