Example usage for org.hibernate ScrollableResults getRowNumber

List of usage examples for org.hibernate ScrollableResults getRowNumber

Introduction

In this page you can find the example usage for org.hibernate ScrollableResults getRowNumber.

Prototype

int getRowNumber();

Source Link

Document

Get the current position in the results.

Usage

From source file:com.lp.server.personal.fastlanereader.ZutrittsklasseobjektHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {
    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;/*  www . j  a  v a2 s  . com*/
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select zutrittsklasseobjekt.i_id from FLRZutrittsklasseobjekt zutrittsklasseobjekt "
                    + this.buildWhereClause() + this.buildOrderByClause();
            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = scrollableResult.getInteger(0); // TYPE OF
                    // KEY
                    // ATTRIBUTE
                    // !!!
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.personal.fastlanereader.ZutrittslogHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {

    getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;// www  .ja v a2  s  .c om
    int rowNumber = 0;

    if (selectedId != null) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            session = setFilter(session);
            String queryString = getFromClause() + buildWhereClause() + buildOrderByClause();

            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    FLRZutrittslog zetistift = (FLRZutrittslog) scrollableResult.get(0);
                    Integer id = zetistift.getI_id();
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.personal.fastlanereader.ZutrittsmodellHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {
    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;/*from  ww  w  . ja  v a 2  s . co m*/
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select zutrittsmodell.i_id from FLRZutrittsmodell zutrittsmodell "
                    + this.buildWhereClause() + this.buildOrderByClause();
            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = scrollableResult.getInteger(0); // TYPE OF
                    // KEY
                    // ATTRIBUTE
                    // !!!
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.personal.fastlanereader.ZutrittsmodelltagdetailHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {
    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;/*from   ww w. ja v  a 2 s . c  o  m*/
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select zutrittsmodelltagdetail.i_id from FLRZutrittsmodelltagdetail zutrittsmodelltagdetail "
                    + this.buildWhereClause() + this.buildOrderByClause();
            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = scrollableResult.getInteger(0); // TYPE OF
                    // KEY
                    // ATTRIBUTE
                    // !!!
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.personal.fastlanereader.ZutrittsmodelltagHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {
    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;//  w w w  . j  a v a 2s .  c o  m
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select zutrittsmodelltag.i_id from FLRZutrittsmodelltag zutrittsmodelltag "
                    + this.buildWhereClause() + this.buildOrderByClause();
            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = scrollableResult.getInteger(0); // TYPE OF
                    // KEY
                    // ATTRIBUTE
                    // !!!
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.personal.fastlanereader.ZutrittsobjektHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {
    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;/*from   www  .j ava 2 s . c  o  m*/
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select zutrittsobjekt.i_id from FLRZutrittsobjekt zutrittsobjekt "
                    + this.buildWhereClause() + this.buildOrderByClause();
            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = (Integer) scrollableResult.getInteger(0); // TYPE
                    // OF
                    // KEY
                    // ATTRIBUTE
                    // !
                    // !
                    // !
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.personal.fastlanereader.ZutrittsobjektverwendungHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {

    getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;/* ww  w.  j  a  v a  2 s.  c  o  m*/
    int rowNumber = 0;

    if (selectedId != null) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            session = setFilter(session);
            String queryString = getFromClause() + buildWhereClause() + buildOrderByClause();

            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    FLRZutrittsobjektverwendung zutrittsobjektverwendung = (FLRZutrittsobjektverwendung) scrollableResult
                            .get(0);
                    Integer id = zutrittsobjektverwendung.getI_id();
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.projekt.fastlanereader.BereichHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {
    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;//  w  w  w  .j a  va2  s.  c  o m
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select bereich.i_id from FLRBereich bereich " + this.buildWhereClause()
                    + this.buildOrderByClause();
            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = scrollableResult.getInteger(0); // TYPE OF
                    // KEY
                    // ATTRIBUTE
                    // !!!
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.projekt.fastlanereader.HistoryartHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {

    getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;/*from  w  w w  .j av a2s.  c  o  m*/
    int rowNumber = 0;

    if (selectedId != null) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            session = setFilter(session);
            String queryString = getFromClause() + buildWhereClause() + buildOrderByClause();

            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    FLRHistoryart artikelkommentarart = (FLRHistoryart) scrollableResult.get(0);
                    Integer iId = artikelkommentarart.getI_id();
                    if (selectedId.equals(iId)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER_FLR, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}

From source file:com.lp.server.projekt.fastlanereader.HistoryHandler.java

License:Open Source License

public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP {

    this.getQuery().setSortKrit(sortierKriterien);

    QueryResult result = null;//from   w w  w  . j a  v  a  2s.c om
    int rowNumber = 0;

    if (selectedId != null && ((Integer) selectedId).intValue() >= 0) {
        SessionFactory factory = FLRSessionFactory.getFactory();
        Session session = null;

        try {
            session = factory.openSession();
            String queryString = "select flrhistory.i_id" + " from FLRHistory flrhistory "
                    + this.buildWhereClause() + this.buildOrderByClause();

            Query query = session.createQuery(queryString);
            ScrollableResults scrollableResult = query.scroll();
            if (scrollableResult != null) {
                scrollableResult.beforeFirst();
                while (scrollableResult.next()) {
                    Integer id = (Integer) scrollableResult.getInteger(0);
                    if (selectedId.equals(id)) {
                        rowNumber = scrollableResult.getRowNumber();
                        break;
                    }
                }
            }
        } catch (Exception e) {
            throw new EJBExceptionLP(EJBExceptionLP.FEHLER, e);
        } finally {
            try {
                session.close();
            } catch (HibernateException he) {
                throw new EJBExceptionLP(EJBExceptionLP.FEHLER, he);
            }
        }
    }

    if (rowNumber < 0 || rowNumber >= this.getRowCount()) {
        rowNumber = 0;
    }

    result = this.getPageAt(new Integer(rowNumber));
    result.setIndexOfSelectedRow(rowNumber);

    return result;
}