Hello friends,
    I am having below function which returns me the list of nodes.
           
      public class GenericJcrDaoImpl<T extends JcrHierarchyNode, PK extends
Serializable> implements  
            GenericJcrDao<T,PK> {
        
         @Autowired
         private JcrMappingTemplate jcrMappingTemplate;

          private Class<T> persistentClass;
 
        public Collection<T> getAll() {
           QueryManager queryManager = jcrMappingTemplate.createQueryManager();
           Filter filter = queryManager.createFilter(persistentClass);
           Query query = queryManager.createQuery(filter);
           query.addOrderByDescending("createTime");
           return (Collection) jcrMappingTemplate.getObjects(query);

        }
       }


 and test case

        @Autowired
        private JcrFileNodeDao jcrFileNodeDao;
        
        @Test
        public void addFileNode() {
                
                Collection<JcrFileNode> jcrFile = jcrFileNodeDao.getAll();      
        
                int firstCount = jcrFile.size();
                                
                JcrFileNode node = new JcrFileNode();
                node.setPath("/pradeep");
                node.setCreationDate(Calendar.getInstance());           
                JcrResourceNode resource = new JcrResourceNode();
                
                String stringToConvert = "This String is 76 characters long and 
will be
converted to an array of bytes";                
            byte[] theByteArray = stringToConvert.getBytes();
                resource.setData(theByteArray/*new 
ByteArrayInputStream(theByteArray)*/);
                resource.setLastModified(Calendar.getInstance());
                resource.setMimeType("Text");
                node.setResource(resource);
                jcrFileNodeDao.save(node);
                                
                jcrFile = jcrFileNodeDao.getAll();      
                Assert.assertEquals(firstCount + 1, jcrFile.size());
        }       


  * Issue is i am not able to view changes made in current changes.
  * If session is closed and again test case is executed the list contains
previous session changes.

Thanks 
Pradeep Kudale 
 

-----
Regards
Pradeep Kudale
-- 
View this message in context: 
http://jackrabbit.510166.n4.nabble.com/OCM-Not-able-to-get-the-list-of-nodes-added-in-current-session-tp2076858p2076858.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Reply via email to