List of usage examples for org.hibernate Query scroll
ScrollableResults scroll();
From source file:com.lp.server.bestellung.fastlanereader.BestellungwareneingangHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * /*from w ww. j ava2 s. c o m*/ * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; if (selectedId != null && ((Integer) selectedId).intValue() >= 0) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select wareneingang." + "i_id" + " from FLRWareneingang wareneingang " + 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 { closeSession(session); } } 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.bestellung.fastlanereader.BestellungWEPEingangHandler.java
License:Open Source License
/** * sorts the data of the current query using the specified criterias and * returns the page of data where the row of selectedId is contained. * //from ww w. j a va 2s. c o m * @param sortierKriterien * the new sort criterias. * @param selectedId * the id of the entity that should be included in the result * page. * @return the sorted data containing the page where the entity with the * specified id is located. * @throws EJBExceptionLP */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; if (selectedId != null && ((Integer) selectedId).intValue() >= 0) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); session = setFilter(session); String queryString = "select position." + "i_id" + " from FLRBestellpositionMitArtikelliste position LEFT OUTER JOIN position.flrartikel.artikelsprset AS aspr " + 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_FLR, e); } finally { closeSession(session); } } 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.bestellung.fastlanereader.BestellvorschlagAlleLieferantenHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * //from ww w .ja va 2s.com * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; // if (selectedId != null && ( (Integer) selectedId).intValue() >= 0) { if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select bestellvorschlagallelieferanten." + "lieferant_i_id" + " from FLRBestellvorschlagAlleLieferanten bestellvorschlagallelieferanten " + 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 { closeSession(session); } } 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.bestellung.fastlanereader.BestellvorschlagAlleTermineHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * //from w ww . jav a 2 s . com * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; // if (selectedId != null && ( (Integer) selectedId).intValue() >= 0) { if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select bestellvorschlagalletermine." + "t_liefertermin" + " from FLRBestellvorschlagAlleTermine bestellvorschlagalletermine " + this.buildWhereClause() + this.buildOrderByClause(); Query query = session.createQuery(queryString); ScrollableResults scrollableResult = query.scroll(); boolean idFound = false; 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 { closeSession(session); } } 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.bestellung.fastlanereader.BestellvorschlagHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * // w w w .j av a 2 s .c om * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; // if (selectedId != null && ( (Integer) selectedId).intValue() >= 0) { if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select bestellvorschlag." + "i_id" + " from FLRBestellvorschlag bestellvorschlag LEFT OUTER JOIN bestellvorschlag.flrartikelliste.artikelsprset AS aspr " + 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 { closeSession(session); } } 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.bestellung.fastlanereader.BSMahnlaufHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * /*from w w w . ja v a2 s . c o m*/ * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; if (selectedId != null && ((Integer) selectedId).intValue() >= 0) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select bsmahnlauf.i_id from FLRBSMahnlauf bsmahnlauf " + 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_FLR, e); } finally { closeSession(session); } } 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.bestellung.fastlanereader.BSMahnstufeHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/*from w ww.ja 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 " + FLR_MAHNSTUFE + BSMahnwesenFac.FLR_MAHNSTUFE_I_ID + FLR_MAHNSTUFE_FROM_CLAUSE + 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_FLR, e); } finally { closeSession(session); } } 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.bestellung.fastlanereader.BSMahntextHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * /*from w w w . j av a 2 s . c o m*/ * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; if (selectedId != null && ((Integer) selectedId).intValue() >= 0) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select " + FLR_MAHNTEXT + BSMahnwesenFac.FLR_MAHNTEXT_I_ID + FLR_MAHNTEXT_FROM_CLAUSE + 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 { closeSession(session); } } 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.bestellung.fastlanereader.BSMahnungHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * // w w w .ja v a 2 s.c o m * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; if (selectedId != null /* && ( (Integer) selectedId).intValue() >= 0 */) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select bsmahnung.i_id from FLRBSMahnung bsmahnung " + 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_FLR, e); } finally { closeSession(session); } } 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.bestellung.fastlanereader.LieferantenoptimierenHandler.java
License:Open Source License
/** * sorts the data described by the current query using the specified sort * criterias. The current query is also updated with the new sort criterias. * //w ww .j a v a 2 s .c om * @see UseCaseHandler#sort(SortierKriterium[], Object) * @throws EJBExceptionLP * @param sortierKriterien * SortierKriterium[] * @param selectedId * Object * @return QueryResult */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; // if (selectedId != null && ( (Integer) selectedId).intValue() >= 0) { if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select flrLieferantenoptimieren." + "bestellvorschlag_i_id" + " from FLRLieferantenoptimieren flrLieferantenoptimieren LEFT OUTER JOIN flrLieferantenoptimieren.flrartikelliste.artikelsprset AS aspr " + 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 { closeSession(session); } } if (rowNumber < 0 || rowNumber >= this.getRowCount()) { rowNumber = 0; } result = this.getPageAt(new Integer(rowNumber)); result.setIndexOfSelectedRow(rowNumber); return result; }