jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Problem with add new Node and search it.
Date Mon, 29 Sep 2008 07:13:12 GMT
Hi,

are you using a transaction around your code? changes to the repository are only
searchable when the transaction is committed.

regards
 marcel

tremek wrote:
> Hi.
> In one function  i add new node some like this:
>   Node rootNode = session.getRootNode();
>   Node kTNode = rootNode.addNode("nameNode","nt:folder");
>   session.save;
> Next i make a Query.XPATH query like this: 
>  StringBuffer query = new StringBuffer();
>  query.append("/jcr:root//element(*,nt:folder)");
>  Workspace ws = session.getWorkspace();
>  QueryManager qm = ws.getQueryManager();
>  Query querySql = qm.createQuery(query.toString(),Query.XPATH);
>  QueryResult result = querySql.execute();
>  for (NodeIterator it = result.getNodes(); it.hasNext(); ) 
>  {
>    //make something
>  }
> The resultset is empty. I noticed, that  ItemState of kTNode  is STATUS_NEW. 
> How to search nodes when them ItemState is STATUS_NEW. 
> When i do search in other function, the state of this node is
> STATUS_UNDEFINED and it works fine.
> Or how to change ItemState of node from STATUS_NEW to STATUS_UNDEFINED?.
> 


Mime
View raw message