Package org.hibernate.criterion

Examples of org.hibernate.criterion.Projection


    List<T> targetList = null;
    if (null == criteriaImpl.getProjection()) {
      criteria.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize()).setMaxResults(
          limit.getPageSize());
      targetList = criteria.list();
      Projection projection = null;
      criteria.setFirstResult(0).setMaxResults(1);
      projection = Projections.rowCount();
      totalCount = ((Number) criteria.setProjection(projection).uniqueResult()).intValue();
    } else {
      List<T> list = criteria.list();
View Full Code Here


    List<?> targetList = null;
    if (null == criteriaImpl.getProjection()) {
      criteria.setFirstResult((limit.getPageNo() - 1) * limit.getPageSize()).setMaxResults(
          limit.getPageSize());
      targetList = criteria.list();
      Projection projection = null;
      criteria.setFirstResult(0).setMaxResults(1);
      projection = Projections.rowCount();
      totalCount = ((Integer) criteria.setProjection(projection).uniqueResult()).intValue();
    } else {
      List<?> list = criteria.list();
View Full Code Here

  public String[] getColumnsUsingProjection(
      Criteria subcriteria,
          String propertyName) throws HibernateException {

    //first look for a reference to a projection alias
    final Projection projection = rootCriteria.getProjection();
    String[] projectionColumns = projection == null ?
                                 null :
                                 projection.getColumnAliases( propertyName, 0 );

    if ( projectionColumns == null ) {
      //it does not refer to an alias of a projection,
      //look for a property
      try {
View Full Code Here

  public Type getTypeUsingProjection(Criteria subcriteria, String propertyName)
      throws HibernateException {

    //first look for a reference to a projection alias
    final Projection projection = rootCriteria.getProjection();
    Type[] projectionTypes = projection == null ?
                             null :
                             projection.getTypes( propertyName, subcriteria, this );

    if ( projectionTypes == null ) {
      try {
        //it does not refer to an alias of a projection,
        //look for a property
View Full Code Here

  public String[] getColumnsUsingProjection(
      Criteria subcriteria,
          String propertyName) throws HibernateException {

    //first look for a reference to a projection alias
    final Projection projection = rootCriteria.getProjection();
    String[] projectionColumns = projection == null ?
                                 null :
                                 projection.getColumnAliases( propertyName, 0 );

    if ( projectionColumns == null ) {
      //it does not refer to an alias of a projection,
      //look for a property
      try {
View Full Code Here

  public Type getTypeUsingProjection(Criteria subcriteria, String propertyName)
      throws HibernateException {

    //first look for a reference to a projection alias
    final Projection projection = rootCriteria.getProjection();
    Type[] projectionTypes = projection == null ?
                             null :
                             projection.getTypes( propertyName, subcriteria, this );

    if ( projectionTypes == null ) {
      try {
        //it does not refer to an alias of a projection,
        //look for a property
View Full Code Here

  public String[] getColumnsUsingProjection(
      Criteria subcriteria,
          String propertyName) throws HibernateException {

    //first look for a reference to a projection alias
    final Projection projection = rootCriteria.getProjection();
    String[] projectionColumns = null;
    if ( projection != null ) {
      projectionColumns = ( projection instanceof EnhancedProjection ?
          ( ( EnhancedProjection ) projection ).getColumnAliases( propertyName, 0, rootCriteria, this ) :
          projection.getColumnAliases( propertyName, 0 )
      );
    }
    if ( projectionColumns == null ) {
      //it does not refer to an alias of a projection,
      //look for a property
View Full Code Here

  @Override
  public Type getTypeUsingProjection(Criteria subcriteria, String propertyName)
      throws HibernateException {

    //first look for a reference to a projection alias
    final Projection projection = rootCriteria.getProjection();
    Type[] projectionTypes = projection == null ?
                             null :
                             projection.getTypes( propertyName, subcriteria, this );

    if ( projectionTypes == null ) {
      try {
        //it does not refer to an alias of a projection,
        //look for a property
View Full Code Here

  public static ProjectionList projectionSupport(Criteria criteria,
      ProjectionList projectionList) throws Exception {
    ProjectionList newProjectionList = Projections.projectionList();
    Map<String, String> aliasesToCreate = new HashMap<String, String>();
    for (int i = 0; i < projectionList.getLength(); i++) {
      Projection projection = projectionList.getProjection(i);
      String projectionString = projection.toString();
      if (projectionString.indexOf(".") != -1) {
        String[] splitedString = projectionString.split("\\.");
        createAlias(criteria, splitedString);
        newProjectionList.add(Projections.property(splitedString[splitedString.length-2]+"."+splitedString[splitedString.length-1]));
      } else {
View Full Code Here

  public static ProjectionList projectionSupport(Criteria criteria,
      ProjectionList projectionList) throws Exception {
    ProjectionList newProjectionList = Projections.projectionList();
    Map<String, String> aliasesToCreate = new HashMap<String, String>();
    for (int i = 0; i < projectionList.getLength(); i++) {
      Projection projection = projectionList.getProjection(i);
      String projectionString = projection.toString();
      if (projectionString.indexOf(".") != -1) {
        String[] splitedString = projectionString.split("\\.");
        createAlias(criteria, splitedString);
        newProjectionList.add(Projections.property(splitedString[splitedString.length-2]+"."+splitedString[splitedString.length-1]));
      } else {
View Full Code Here

TOP

Related Classes of org.hibernate.criterion.Projection

Copyright © 2018 www.massapicom. 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.