JDBaccess API 1.0

com.jdbaccess.da
Interface Select

All Superinterfaces:
DataAccess

public interface Select
extends DataAccess

Interface for selecting objects: with Select you define and execute sql selects.

Example:
   Select select = new Select();
   select.setSql("select * from employee");
   Result result = select.execute();
   ArrayList list = result.getAllElements();
   long count = result.getSize();
   select.end();
 


Method Summary
 Result execute()
          Executes the given Select-object
 java.util.ArrayList getOrderBy()
           
 java.lang.String getSqlCount()
           
 void setOrderBy(java.util.ArrayList orderByFieldNames)
          Set the order by fields.
 void setResultFieldType(java.lang.String fieldName, java.lang.Class type)
          If you do not want to get the default class type for a field in your select result, you can set a field to a specific class type.
 void setResultType(java.lang.Class type)
          Set the result of the select to a specific class which means that all elements which are returned in that result are of this type.
 void setSqlCount(java.lang.String sqlCount)
          Too gain further performance for method getSize() you can define countSelects on your select.
 
Methods inherited from interface com.jdbaccess.da.DataAccess
end, getName, getObjectType, getPackageName, getSize, getSql, setName, setObjectType, setPackageName, setParameters, setSql, toString
 

Method Detail

execute

Result execute()
               throws ApplicationException
Executes the given Select-object

Returns:
result of that select
Throws:
ApplicationException

setResultType

void setResultType(java.lang.Class type)
Set the result of the select to a specific class which means that all elements which are returned in that result are of this type. If a result type is not set the default type is Row.

Parameters:
type -

setResultFieldType

void setResultFieldType(java.lang.String fieldName,
                        java.lang.Class type)
If you do not want to get the default class type for a field in your select result, you can set a field to a specific class type. For example if a select returns a BigDecimal-object for a field "a" you can overwrite that default type specifically with "setResultFieldType("a", Double.class)" so that in field "a" Double values are returned in result getNextElements. If a result type is not set the default type is build internally with the sqlType.

Parameters:
fieldName -
type -

setSqlCount

void setSqlCount(java.lang.String sqlCount)
Too gain further performance for method getSize() you can define countSelects on your select. If set this count sql string is executed in the getSize() method

Parameters:
sqlCount -

getSqlCount

java.lang.String getSqlCount()
Returns:
your own defined count sql string

setOrderBy

void setOrderBy(java.util.ArrayList orderByFieldNames)
Set the order by fields. Example: ArrayList orderBy = new ArrayList(); orderBy.add("salary desc"); orderBy.add("name");

Parameters:
orderByFieldNames -

getOrderBy

java.util.ArrayList getOrderBy()
Returns:
your own defined orderByFieldNames

JDBaccess API 1.0

Copyright © 2005-2006 JDBaccess.com, Königsweg 210, D-14129 Berlin, Germany. All Rights Reserved.