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 reportvariante.i_id from FLRReportvariante reportvariante " + 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); // 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; }
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_ZVL + EingangsrechnungFac.FLR_ZV_LAUF_I_ID + FLR_ZVL_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 = 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; }
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { 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()) { FLRLohnartstundenfaktor artikelkommentarart = (FLRLohnartstundenfaktor) 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; }
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_WVKNR + FinanzServiceFac.FLR_WARENVERKEHRSNUMMER_C_NR + FLR_WVKNR_FROM_CLAUSE + this.buildWhereClause() + this.buildOrderByClause(); Query query = session.createQuery(queryString); ScrollableResults scrollableResult = query.scroll(); if (scrollableResult != null) { scrollableResult.beforeFirst(); while (scrollableResult.next()) { String id = scrollableResult.getString(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; }