com.j256.ormlite.dao.RawRowMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ormlite-core Show documentation
Show all versions of ormlite-core Show documentation
Lightweight Object Relational Model (ORM) for persisting objects to SQL databases.
package com.j256.ormlite.dao;
import java.sql.SQLException;
import com.j256.ormlite.stmt.QueryBuilder;
/**
* Parameterized row mapper that takes output from the {@link GenericRawResults} and returns a T. Is used in the
* {@link Dao#queryRaw(String, RawRowMapper, String...)} method.
*
*
* NOTE: If you need to map Objects instead then consider using the {@link RawRowObjectMapper} with the
* {@link Dao#queryRaw(String, com.j256.ormlite.field.DataType[], RawRowObjectMapper, String...)} method which allows
* you to iterate over the raw results as Object[].
*
*
* @param
* Type that the mapRow returns.
* @author graywatson
*/
public interface RawRowMapper {
/**
* Used to convert a raw results row to an object.
*
*
* NOTE: If you are using the {@link QueryBuilder#prepareStatementString()} to build your query, it may have
* added the id column to the selected column list if the Dao object has an id you did not include it in the columns
* you selected. So the results might have one more column than you are expecting.
*
*
* @return The created object with all of the fields set from the results. Return null if there is no object
* generated from these results.
* @param columnNames
* Array of names of columns.
* @param resultColumns
* Array of result columns.
* @throws SQLException
* If there is any critical error with the data and you want to stop the paging.
*/
public T mapRow(String[] columnNames, String[] resultColumns) throws SQLException;
}