Package org.hibernate.criterion

Examples of org.hibernate.criterion.Projection


  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


          .add( Projections.property("c.courseCode") )
          .add( Projections.property("c.description") )
        )
      .uniqueResult();
     
    Projection p1 = Projections.projectionList()
      .add( Projections.count("studentNumber") )
      .add( Projections.max("studentNumber") )
      .add( Projections.rowCount() );
   
    Projection p2 = Projections.projectionList()
      .add( Projections.min("studentNumber") )
      .add( Projections.avg("studentNumber") )
      .add( Projections.sqlProjection(
          "1 as constOne, count(*) as countStar",
          new String[] { "constOne", "countStar" },
View Full Code Here

          .add( Property.forName("c.courseCode") )
          .add( Property.forName("c.description") )
        )
      .uniqueResult();
     
    Projection p1 = Projections.projectionList()
      .add( Property.forName("studentNumber").count() )
      .add( Property.forName("studentNumber").max() )
      .add( Projections.rowCount() );
   
    Projection p2 = Projections.projectionList()
      .add( Property.forName("studentNumber").min() )
      .add( Property.forName("studentNumber").avg() )
      .add( Projections.sqlProjection(
          "1 as constOne, count(*) as countStar",
          new String[] { "constOne", "countStar" },
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

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.