List of usage examples for org.hibernate ScrollableResults getRowNumber
int getRowNumber();
From source file:com.lp.server.partner.fastlanereader.AnsprechpartnerHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;//from ww w. j a v a 2s.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 ansprechpartner.i_id from FLRAnsprechpartner ansprechpartner " + 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.BankHandler.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.j a v a 2s . 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 { 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 bank.i_id from FLRBank bank " + 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_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.partner.fastlanereader.BrancheHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;//from w ww . jav a 2 s . co 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()) { FLRBranche branche = (FLRBranche) scrollableResult.get(0); Integer iId = branche.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, 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.generated.SerienbriefselektionHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;// w ww . j a v a2s . c o m int rowNumber = 0; if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select serienbriefselektion.id_comp.selektion_i_id from FLRSerienbriefselektion as serienbriefselektion " + 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.KommunikationsartHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { getQuery().setSortKrit(sortierKriterien); QueryResult result = null;// w w w.j a v a2s. c o m int rowNumber = 0; if (selectedId != null) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = getFromClause() + buildWhereClause() + buildOrderByClause(); Query query = session.createQuery(queryString); ScrollableResults scrollableResult = query.scroll(); if (scrollableResult != null) { scrollableResult.beforeFirst(); while (scrollableResult.next()) { FLRKommunikationsart kommunikationsart = (FLRKommunikationsart) scrollableResult.get(0); String cNr = kommunikationsart.getC_nr(); if (selectedId.equals(cNr)) { 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 >= getRowCount()) { rowNumber = 0; } result = getPageAt(new Integer(rowNumber)); result.setIndexOfSelectedRow(rowNumber); return result; }
From source file:com.lp.server.partner.fastlanereader.KontaktartHandler.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 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()) { FLRKontaktart selektion = (FLRKontaktart) scrollableResult.get(0); Integer iId = selektion.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, 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.KontaktHandler.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 2 s . co 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()) { FLRKontakt selektion = (FLRKontakt) scrollableResult.get(0); Integer iId = selektion.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, 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.KundeHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/*from w w w. java 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 = getFromClause() + buildWhereClause() + 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_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.partner.fastlanereader.KundesokoHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/*from www. j av a 2s. 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 " + FLR_KUNDESOKO + "i_id" + FLR_KUNDESOKO_FROM_CLAUSE + 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; }
From source file:com.lp.server.partner.fastlanereader.KundesokomengenstaffelHandler.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 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 " + FLR_KUNDESOKOMENGENSTAFFEL + "i_id" + FLR_KUNDESOKOMENGENSTAFFEL_FROM_CLAUSE + 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; }