Examples of JPAQuery


Examples of com.mysema.query.jpa.impl.JPAQuery

        assertEquals(expr.hashCode(), expr2.hashCode());
    }

    @Test
    public void Query() throws ClassNotFoundException, IOException {
        JPAQuery query = new JPAQuery();
        query.from(QCat.cat);
        query.where(serialize(QCat.cat.name.eq("test")));
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

    private EntityManager entityManager;

    @Override
    protected JPAQuery query() {
        return new JPAQuery(entityManager);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

        return new JPADeleteClause(entityManager, path);
    }

    @Override
    protected JPAQuery testQuery() {
        return new JPAQuery(entityManager, new DefaultQueryMetadata().noValidate());
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

public class JPAQueryMutabilityTest {

    private EntityManager entityManager;

    protected JPAQuery query() {
        return new JPAQuery(entityManager);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

    }

    @Test
    public void test() {
        QCat cat = QCat.cat;
        JPAQuery query = query().from(cat);

        query.count();
        assertProjectionEmpty(query);
        query.distinct().count();
        assertProjectionEmpty(query);

        query.iterate(cat);
        assertProjectionEmpty(query);
        query.iterate(cat,cat);
        assertProjectionEmpty(query);
        query.distinct().iterate(cat);
        assertProjectionEmpty(query);
        query.distinct().iterate(cat,cat);
        assertProjectionEmpty(query);

        query.list(cat);
        assertProjectionEmpty(query);
        query.list(cat,cat);
        assertProjectionEmpty(query);
        query.distinct().list(cat);
        assertProjectionEmpty(query);
        query.distinct().list(cat,cat);
        assertProjectionEmpty(query);

        query.listResults(cat);
        assertProjectionEmpty(query);
        query.distinct().listResults(cat);
        assertProjectionEmpty(query);

        query.map(cat.name, cat);
        assertProjectionEmpty(query);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

    }

    @Test
    public void Clone() {
        QCat cat = QCat.cat;
        JPAQuery query = query().from(cat).where(cat.name.isNotNull());
        JPAQuery query2 = query.clone(entityManager);
        assertEquals(query.getMetadata().getJoins(), query2.getMetadata().getJoins());
        assertEquals(query.getMetadata().getWhere(), query2.getMetadata().getWhere());
        query2.list(cat);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

        Mode.mode.remove();
        Mode.target.remove();
    }

    private JPAQuery query() {
        return new JPAQuery(entityManager);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

        for (Map.Entry<String, ?> entry : filters.entrySet()) {
            SimplePath<Object> property = new SimplePath<Object>(entry.getValue().getClass(), entityPath, entry.getKey());
            builder.and(property.eq(entry.getValue()));
        }
        ComparablePath<?> sortProperty = new ComparablePath(Comparable.class, entityPath, sort);
        return new JPAQuery(em).from(entityPath).where(builder.getValue()).orderBy(sortProperty.asc()).list(entityPath);
    }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

 
  private static final QProjectVersion qProjectVersion = QProjectVersion.projectVersion;
 
  @Override
  public ProjectVersion getByProjectAndVersion(Project project, String version) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qProjectVersion)
      .where(qProjectVersion.project.eq(project))
      .where(qProjectVersion.version.eq(version));
   
    return query.uniqueResult(qProjectVersion);
  }
View Full Code Here

Examples of com.mysema.query.jpa.impl.JPAQuery

    return fullTextEntityManager.createFullTextQuery(booleanJunction.createQuery(), User.class);
  }
 
  @Override
  public List<ArtifactVersionNotification> listLastNotifications(User user, long limit) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qArtifactVersionNotification)
      .where(qArtifactVersionNotification.user.eq(user))
      .orderBy(qArtifactVersionNotification.creationDate.desc())
      .limit(limit);
   
    return query.list(qArtifactVersionNotification);
  }
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.