1 Reply Latest reply on Aug 1, 2014 8:13 AM by Horia Chiorean

    javax.jcr.query.InvalidQueryException: Table does not exist. when adding multiple nodetypes

    Bjoern Schmidt Newbie

      Hi there,


      I'm currently facing a porblem I'm unable to understand or solve:


      If I create two new NodeTypes and then ask for the second one, I get a javax.jcr.query.InvalidQueryException.


      Note that the first search works, only the second one fails.


      If have no idea what is happening or what I maybe do wrong.


      Any help is appreciated.

      @TestControl(startScopes = ApplicationScoped.class)
      public class CDITest {
        private Session session;
        private void regNodeType(Session repoSession, String typeName) throws RepositoryException{
        NodeTypeManager mgr = repoSession.getWorkspace().getNodeTypeManager();
        // Create a template for the node type ...
        NodeTypeTemplate type = mgr.createNodeTypeTemplate();
        type.setDeclaredSuperTypeNames(new String[]{CrConstants.JCR_NT_UNSTRUCTURED});
        mgr.registerNodeType(type, true);
        private void fireQuery(Session repoSession, String typeName) throws RepositoryException{
        Query query = repoSession.getWorkspace().getQueryManager().createQuery(
        "SELECT BASE.* FROM [" + typeName + "] AS BASE ", Query.JCR_SQL2);
        private Node saveNode(Session repoSession, String typeName) throws RepositoryException{
        Node root = repoSession.getNode("/");
        Node x = root.addNode("xyz:XYZ", typeName);
        return x;
        private void regNs(Session repoSession) throws RepositoryException{
        NamespaceRegistry reg = repoSession.getWorkspace().getNamespaceRegistry();
        reg.registerNamespace("xyz", "org://some");
        public void test000Schrott() throws RepositoryException {
        regNodeType(session, "xyz:pommes");
        fireQuery(session, "xyz:pommes");
        Node x = saveNode(session, "xyz:pommes");
        x.setProperty("some", "thing");
        regNodeType(session, "xyz:mayo");
        fireQuery(session, "xyz:mayo");