Package org.compiere.model
Class POResultSet<T extends PO>
- java.lang.Object
-
- org.compiere.model.POResultSet<T>
-
- All Implemented Interfaces:
AutoCloseable
public class POResultSet<T extends PO> extends Object implements AutoCloseable
Simple wrapper over jdbc resultset- Author:
- Low Heng Sin, Teo Sarca, SC ARHIPAC SERVICE SRL
- FR [ 1984834 ] Add POResultSet.hasNext convenient method
- FR [ 1985134 ] POResultSet improvements
-
-
Constructor Summary
Constructors Constructor Description POResultSet(MTable table, PreparedStatement ps, ResultSet rs, String trxName)Constructs the POResultSet.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Release database resources.booleanhasNext()booleanisCloseOnError()Will be thePreparedStatementandResultSetclosed on any database exceptionTnext()voidsetCloseOnError(boolean closeOnError)Should we automatically close thePreparedStatementandResultSetin case we get an error.
-
-
-
Constructor Detail
-
POResultSet
public POResultSet(MTable table, PreparedStatement ps, ResultSet rs, String trxName)
Constructs the POResultSet. By default, closeOnError option is false. You need to set it explicitly.- Parameters:
table-ps-rs-trxName-
-
-
Method Detail
-
hasNext
public boolean hasNext() throws DBException- Returns:
- true if it has next, false otherwise
- Throws:
DBException
-
next
public T next() throws DBException
- Returns:
- PO or null if reach the end of resultset
- Throws:
DBException
-
setCloseOnError
public void setCloseOnError(boolean closeOnError)
Should we automatically close thePreparedStatementandResultSetin case we get an error.- Parameters:
closeOnError-
-
isCloseOnError
public boolean isCloseOnError()
Will be thePreparedStatementandResultSetclosed on any database exception- Returns:
- true if yes, false otherwise
-
close
public void close()
Release database resources.- Specified by:
closein interfaceAutoCloseable
-
-