List of usage examples for org.hibernate ScrollableResults beforeFirst
void beforeFirst();
From source file:com.lp.server.personal.fastlanereader.KollektivuestdHandler.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 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 kollektivuestd.i_id from FLRKollektivuestd kollektivuestd " + 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.personal.fastlanereader.LohnartHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { getQuery().setSortKrit(sortierKriterien); QueryResult result = null;// w w w. ja va 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()) { FLRLohnart artikelkommentarart = (FLRLohnart) 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.personal.fastlanereader.LohnartstundenfaktorHandler.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 a2 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()) { 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; }
From source file:com.lp.server.personal.fastlanereader.LohngruppeHandler.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 .jav 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 lohngruppe.i_id from FLRLohngruppe lohngruppe " + 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_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.MaschineHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { getQuery().setSortKrit(sortierKriterien); QueryResult result = null;//w ww. j a v a2 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()) { FLRMaschine maschine = (FLRMaschine) scrollableResult.get(0); Integer id = maschine.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.MaschinengruppeHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/*w w w . ja va 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 maschinengruppe.i_id from FLRMaschinengruppe maschinengruppe " + 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.MaschinenkostenHandler.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 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()) { FLRMaschinenkosten maschine = (FLRMaschinenkosten) scrollableResult.get(0); Integer id = maschine.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.MaschinenzeitdatenGutSchlechtHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;//w w w.ja v a2 s . co m int rowNumber = 0; if (selectedId != null && selectedId instanceof Integer && ((Integer) selectedId).intValue() >= 0) { SessionFactory factory = FLRSessionFactory.getFactory(); Session session = null; try { session = factory.openSession(); String queryString = "select maschinenzeitdaten.i_id from FLRMaschinenzeitdaten maschinenzeitdaten " + 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_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.PendlerpauschaleHandler.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 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 pendlerpauschale.i_id from FLRPendlerpauschale pendlerpauschale " + 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.PersonalangehoerigeHandler.java
License:Open Source License
public QueryResult sort(SortierKriterium[] sortierKriterien, Object selectedId) throws EJBExceptionLP { this.getQuery().setSortKrit(sortierKriterien); QueryResult result = null;/* ww w . j a va 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 personalangehoerige.i_id from FLRPersonalangehoerige personalangehoerige " + 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; }