Package org.hibernate

Examples of org.hibernate.Query.list()


  }

  public List<ProcessDefinition> findProcessDefinitions(String name) {
    Query query = session.getNamedQuery("findProcessDefinitionsByName");
    query.setString("name", name);
    return query.list();
  }

  public ProcessDefinition findProcessDefinition(String name, int version) {
    Query query = session.getNamedQuery("findProcessDefinitionByNameAndVersion");
    query.setString("name", name);
View Full Code Here


    return timer;
  }

  public List<Timer> findAllTimers() {
    Query query = session.getNamedQuery("findAllTimers");
    return query.list();
  }

  public Execution findExecution(String processDefinitionName, String key) {
    Query query = session.getNamedQuery("findExecutionByProcessDefinitionNameAndKey");
    query.setString("name", processDefinitionName);
View Full Code Here

  @SuppressWarnings("unchecked")
  public List<Job> findExclusiveJobs(Execution processInstance) {
    Query query = hibernateSession.getSession().getNamedQuery("findExclusiveJobs");
    query.setTimestamp("now", Clock.getCurrentTime());
    query.setEntity("processInstance", processInstance);
    return query.list();
  }

  public Job getFirstDueJob() {
    Query query = hibernateSession.getSession().getNamedQuery("getFirstDueJob");
    query.setTimestamp("now", Clock.getCurrentTime());
View Full Code Here

    Query query = session.createNativeQuery( "{ $query : { author : 'Oscar Wilde' }, $orderby : { name : 1 } }" )
        .addEntity( OscarWildePoem.class )
        .setFirstResult( 1 );
    @SuppressWarnings("unchecked")
    List<OscarWildePoem> result = query.list();

    assertThat( result ).onProperty( "id" ).containsExactly( 3L, 1L );

    transaction.commit();
    session.clear();
View Full Code Here

    Query query = session.createNativeQuery( "{ $query : { author : 'Oscar Wilde' }, $orderby : { name : 1 } }" )
        .addEntity( OscarWildePoem.class )
        .setMaxResults( 2 );
    @SuppressWarnings("unchecked")
    List<OscarWildePoem> result = query.list();

    assertThat( result ).onProperty( "id" ).containsExactly( 2L, 3L );

    transaction.commit();
    session.clear();
View Full Code Here

    String nativeQuery = "{ name : 'Her Voice' }";

    Query query = session.createNativeQuery( nativeQuery )
        .addEntity( OscarWildePoem.class );

    List<OscarWildePoem> result = query.list();
    assertThat( result ).isEmpty();

    OscarWildePoem voice = new OscarWildePoem( 4L, "Her Voice", "Oscar Wilde" );
    session.persist( voice );
View Full Code Here

    assertThat( result ).isEmpty();

    OscarWildePoem voice = new OscarWildePoem( 4L, "Her Voice", "Oscar Wilde" );
    session.persist( voice );

    result = query.list();
    assertThat( result ).onProperty( "id" ).containsExactly( 4L );

    transaction.commit();

    transaction = session.beginTransaction();
View Full Code Here

  Map<String, Object> parameterMap = getParameterMap();
  parameterMap.put(USER_OBJ_ID, dto.getUserObjId());
  try {
      LOG.debug("Entering getPostsByUserId >> UserPostsDAOImpl");
      query = getNamedQuery(GET_POSTS_BY_USER_ID, parameterMap);
      postsList = (List<Posts>) query.list();
  }
  catch (Exception e) {
      LOG.error("Error occured while getting Posts : " + e);
  }
  finally {
View Full Code Here

  Map<String, Object> parameterMap = getParameterMap();
  parameterMap.put(USER_OBJ_ID, userId);
  try {
      LOG.debug("Entering getPotsByUserId >> UserPostsDAOImpl");
      query = getNamedQuery(GET_POSTS_BY_USER_ID, parameterMap);
      posts = (List<Posts>) query.list();
  }
  catch (Exception e) {
      LOG.error("Error occured while getting Posts : " + e);
  }
  finally {
View Full Code Here

      sb.append(" Where ").append(condition);
    if (orderBy != null)
      sb.append(" Order By ").append(orderBy);
    try {
      Query query = session.createQuery(sb.toString());
      List list = query.list();
      return (Tmp_licitaciones_palabrasemanticas[]) list.toArray(new Tmp_licitaciones_palabrasemanticas[list.size()]);
    }
    catch (Exception e) {
      e.printStackTrace();
      throw new PersistentException(e);
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.