Package com.mysema.query.jpa.impl

Examples of com.mysema.query.jpa.impl.JPAQuery.from()


   
    @Test
    public void test() throws IOException, ClassNotFoundException{
        // create query
        JPAQuery query = new JPAQuery(entityManager);
        query.from(cat).where(cat.name.eq("Kate")).list(cat);
       
        // get metadata
        QueryMetadata metadata = query.getMetadata();
        assertFalse(metadata.getJoins().isEmpty());
        assertTrue(metadata.getWhere() != null);
View Full Code Here


    }

    @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

 
  @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

 
  @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

 
  @Override
  public List<ArtifactVersionNotification> listNotificationsAfterDate(User user, Date date) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qArtifactVersionNotification)
      .where(qArtifactVersionNotification.user.eq(user))
      .where(qArtifactVersionNotification.creationDate.after(date))
      .orderBy(qArtifactVersionNotification.creationDate.desc());
   
    return query.list(qArtifactVersionNotification);
View Full Code Here

 
  @Override
  public FollowedArtifact getFollowedArtifact(User user, Artifact artifact) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qFollowedArtifact)
      .where(qFollowedArtifact.user.eq(user))
      .where(qFollowedArtifact.artifact.eq(artifact));
   
    return query.singleResult(qFollowedArtifact);
  }
View Full Code Here

  public List<User> listByUserGroup(UserGroup userGroup) {
    JPAQuery query = new JPAQuery(getEntityManager());
    QUser qUser = QUser.user;
    QUserGroup qUserGroup = QUserGroup.userGroup;
   
    query.from(qUser)
        .join(qUser.groups, qUserGroup)
        .where(qUserGroup.eq(userGroup))
        .orderBy(qUser.lastName.lower().asc(), qUser.firstName.lower().asc());
   
    return query.list(qUser);
View Full Code Here

 
  @Override
  public List<ArtifactVersion> listArtifactVersionsAfterDate(Artifact artifact, Date date) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qArtifactVersion)
      .where(qArtifactVersion.artifact.eq(artifact))
      .where(qArtifactVersion.lastUpdateDate.gt(date))
      .orderBy(qArtifactVersion.lastUpdateDate.desc());
   
    return query.list(qArtifactVersion);
View Full Code Here

 
  @Override
  public Artifact getByGroupIdArtifactId(String groupId, String artifactId) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qArtifact)
      .where(qArtifact.group.groupId.eq(groupId))
      .where(qArtifact.artifactId.eq(artifactId));
   
    return query.uniqueResult(qArtifact);
  }
View Full Code Here

 
  @Override
  public List<Artifact> listMostFollowedArtifacts(int limit) {
    JPAQuery query = new JPAQuery(getEntityManager());
   
    query.from(qArtifact)
      .where(qArtifact.deprecationStatus.eq(ArtifactDeprecationStatus.NORMAL))
      .orderBy(qArtifact.followersCount.desc())
      .limit(limit);
   
    return query.list(qArtifact);
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.