List of usage examples for org.hibernate ScrollableResults getRowNumber
int getRowNumber();
From source file:com.lp.server.lieferschein.fastlanereader.AuftraegeEinesLieferscheinsHandler.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 2 s.c om*/ * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ 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 distinct " + LieferscheinpositionFac.FLR_LIEFERSCHEINPOSITION_FLRPOSITIONENSICHTAUFTRAG + "." + AuftragpositionFac.FLR_AUFTRAGPOSITION_AUFTRAG_I_ID + FLR_LIEFERSCHEINPOSITION_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 { 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; }
From source file:com.lp.server.lieferschein.fastlanereader.AuftragpositionInLieferscheinHandler.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. * // www .j a v a 2 s.com * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ 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_LIEFERSCHEINPOSITION + "i_id" + FLR_LIEFERSCHEINPOSITION_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_LIEFERSCHEIN_DIEZUGEHOERIGELIEFERSCHEINPOSITIONWURDEGELOESCHT, 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; }
From source file:com.lp.server.lieferschein.fastlanereader.BegruendungHandler.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 w ww . j a v a 2 s. c o m*/ * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; 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()) { FLRBegruendung lieferscheinart = (FLRBegruendung) scrollableResult.get(0); Integer c_nr = lieferscheinart.getI_id(); if (selectedId.equals(c_nr)) { 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, 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.lieferschein.fastlanereader.LieferscheinartHandler.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. * // ww w .j a va 2 s. c o m * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; 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()) { FLRLieferscheinart lieferscheinart = (FLRLieferscheinart) scrollableResult.get(0); String c_nr = lieferscheinart.getC_nr(); if (selectedId.equals(c_nr)) { 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, 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.lieferschein.fastlanereader.LieferscheinHandler.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. * // ww w .ja v a 2s . c o m * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ 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_LIEFERSCHEIN + LieferscheinFac.FLR_LIEFERSCHEIN_I_ID + FLR_LIEFERSCHEIN_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 { 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; }
From source file:com.lp.server.lieferschein.fastlanereader.LieferscheinpositionartHandler.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 w ww .java2 s.c o m * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null; int rowNumber = 0; if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select " + FLR_LIEFERSCHEINPOSITIONART + LieferscheinServiceFac.FLR_LIEFERSCHEINPOSITIONART_POSITIONSART_C_NR + FLR_LIEFERSCHEINPOSITIONART_FROM_CLAUSE + this.buildWhereClause() + this.buildOrderByClause(); Query query = session.createQuery(queryString); ScrollableResults scrollableResult = query.scroll(); if (scrollableResult != null) { scrollableResult.beforeFirst(); while (scrollableResult.next()) { String c_nr = (String) scrollableResult.getString(0); if (selectedId.equals(c_nr)) { 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, 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.lieferschein.fastlanereader.LieferscheinpositionHandler.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 a va 2 s. c o m * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ 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_LIEFERSCHEINPOSITION + LieferscheinpositionFac.FLR_LIEFERSCHEINPOSITION_I_ID + FLR_LIEFERSCHEINPOSITION_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 { 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; }
From source file:com.lp.server.lieferschein.fastlanereader.LieferscheintextHandler.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 av a 2 s .co m * @param sortierKriterien * nach diesen Kriterien wird das Ergebnis sortiert * @param selectedId * auf diesem Datensatz soll der Cursor stehen * @return QueryResult das Ergebnis der Abfrage * @throws EJBExceptionLP * Ausnahme * @see UseCaseHandler#sort(SortierKriterium[], Object) */ public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { final String METHOD_NAME = "sort"; 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_LIEFERSCHEINTEXT + LieferscheinServiceFac.FLR_LIEFERSCHEINTEXT_I_ID + FLR_LIEFERSCHEINTEXT_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 { 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; }
From source file:com.lp.server.partner.fastlanereader.AnredeHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/*from w ww.j a v a 2s . 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()) { FLRAnrede anrede = (FLRAnrede) scrollableResult.get(0); String cNr = anrede.getC_nr(); if (selectedId.equals(cNr)) { 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, 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.partner.fastlanereader.AnsprechpartnerfunktionHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/*www. j av a 2 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()) { FLRAnsprechpartnerfunktion ansprechpartnerfunktion = (FLRAnsprechpartnerfunktion) scrollableResult .get(0); Integer id = ansprechpartnerfunktion.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, he); } } } if (rowNumber < 0 || rowNumber >= getRowCount()) { rowNumber = 0; } result = getPageAt(new Integer(rowNumber)); result.setIndexOfSelectedRow(rowNumber); return result; }