title: jcr query construct
body: <p>I am building a jcr query and receive data from repository. Here is my code:</p>
  
  <pre><code>    String queryString = "SELECT * FROM public:hours";
  
  try {
    // get session
    Session session = requestContext.getSession();
  
    // create query from queryString constructed
    Query q = session.getWorkspace().getQueryManager().createQuery(queryString, Query.JCR_SQL2); 
  
    // execute query and retrieve result
    QueryResult result = q.execute();  
  
  
    // debug line
    log.error("query is", q.getStatement());
  ....
  </code></pre>
  
  <p>But this can not execute successfully. It gives me an error that</p>
  
  <pre><code>Repositorty Failed: 
  [INFO] [talledLocalContainer] javax.jcr.query.InvalidQueryException: Query:
  [INFO] [talledLocalContainer] SELECT * FROM public:(*)hours; expected: &lt;end&gt;
  </code></pre>
  
  <p>In the jcr-shell, it works if I type in <code>query sql "select * from public:hours"</code> and will give me proper results.
  <br>
  I searched many references but almost every example is the same as mine. so I am not sure where the problem is.
  Anyone have experience with this please help.</p>