cancel
Showing results for 
Search instead for 
Did you mean: 

hibernate sql queries

vinhqchu
Champ in-the-making
Champ in-the-making
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
1 REPLY 1

vinhqchu
Champ in-the-making
Champ in-the-making
just in case anyone else needs to do this, i had to inject the sessionFactory bean into the faces-config-beans.xml file. the bean is defined in hibernate-context.xml.