Examples of QueryVO


Examples of net.sf.oqt.model.QueryVO

  public void testSimpleSelectH2() throws Exception {
    setupH2();
    if (VersionSupport.isNotSupported(CoreFactory.getProperties())) {
      return;
    }
    final QueryVO q = new QueryVO("name", "select ent from TableA ent");
    JPATransformer.transform(q);
    assertThat(q.getError()).isNull();
    assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1);
    assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1);
    assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0");
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

  public void testWithParamH2() throws Exception {
    setupH2();
    if (VersionSupport.isNotSupported(CoreFactory.getProperties())) {
      return;
    }
    final QueryVO q = new QueryVO("name", "select ent from TableA ent where ent.id = :id");
    JPATransformer.transform(q);
    assertThat(q.getError()).isNull();
    assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1);
    assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1);
    assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0 where (t0.ID = ?)");
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

    assertThat(packages).isNotNull().isNotEmpty().hasSize(3);
    Collection<EntityVO> entities = r.getPackages().iterator().next().getEntities();
    assertThat(entities).isNotNull().isNotEmpty().hasSize(TestInfo.numberOfEntities - TestInfo.numberOfEntitiesInGenericPackage - TestInfo.numberOfEntitiesInSubPackage);
    Collection<QueryVO> queries = entities.iterator().next().getQueries();
    assertThat(queries).isNotNull().isNotEmpty().hasSize(4);
    QueryVO query = queries.iterator().next();
    assertThat(query).isNotNull();
    assertThat(query.getSQLQuery()).isNotNull().isNotEmpty();
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

  }

  @Test
  public void testSimpleSelectDerby() throws Exception {
    setupDerby();
    final QueryVO q = new QueryVO("name", "select ent from TableA ent");
    JPATransformer.transform(q);
    assertThat(q.getError()).isNull();
    assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1);
    assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1);
    assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0");
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

  }

  @Test
  public void testWithParamDerby() throws Exception {
    setupDerby();
    final QueryVO q = new QueryVO("name", "select ent from TableA ent where ent.id = :id");
    JPATransformer.transform(q);
    assertThat(q.getError()).isNull();
    assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1);
    assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1);
    assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0 where (t0.ID = ?)");
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

  }

  @Test
  public void testSimpleSelectHSQL() throws Exception {
    setupHSQL();
    final QueryVO q = new QueryVO("name", "select ent from TableA ent");
    JPATransformer.transform(q);
    assertThat(q.getError()).isNull();
    assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1);
    assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1);
    assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0");
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

  }

  @Test
  public void testWithParamHSQL() throws Exception {
    setupHSQL();
    final QueryVO q = new QueryVO("name", "select ent from TableA ent where ent.id = :id");
    JPATransformer.transform(q);
    assertThat(q.getError()).isNull();
    assertThat(q.getSQLQuery()).isNotNull().isNotEmpty().hasSize(1);
    assertThat(CoreFactory.getQueries()).isNotEmpty().hasSize(1);
    assertThat(q.getSQLQuery().iterator().next()).isEqualToIgnoringCase("SELECT t0.ID, t0.AGE, t0.COMMENT, t0.FAV, t0.NAME, t0.SURNAME FROM TABLE_A t0 where (t0.ID = ?)");
  }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

                final Class<?> clazz = Class.forName(packge.getName() + "." + entity.getName());
                final Annotation[] annotations = clazz.getAnnotations();
                for (final Annotation annotation : annotations) {
                    if (annotation.annotationType().equals(NamedQuery.class)) {
                        final NamedQuery nq = (NamedQuery) annotation;
                        entity.getQueries().add(new QueryVO(nq.name(), nq.query()));
                    } else if (annotation.annotationType().equals(NamedQueries.class)) {
                        final NamedQueries nqs = (NamedQueries) annotation;
                        for (final NamedQuery nq : nqs.value()) {
                            entity.getQueries().add(new QueryVO(nq.name(), nq.query()));
                        }
                    }
                }
            }
            Collections.sort(packge.getEntities());
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

            final Iterator<EntityVO> entIt = pack.getEntities().iterator();
            while (entIt.hasNext()) {
                final EntityVO ent = entIt.next();
                final Iterator<QueryVO> qIt = ent.getQueries().iterator();
                while (qIt.hasNext()) {
                    final QueryVO q = qIt.next();
                    transform(q);
                }
            }
        }
    }
View Full Code Here

Examples of net.sf.oqt.model.QueryVO

            final Iterator<EntityVO> entIt = pack.getEntities().iterator();
            while (entIt.hasNext()) {
                final EntityVO ent = entIt.next();
                final Iterator<QueryVO> qIt = ent.getQueries().iterator();
                while (qIt.hasNext()) {
                    final QueryVO q = qIt.next();
                    validate(q);
                }
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.