クラス TableMapping<T>
- java.lang.Object
-
- org.nkjmlab.sorm4j.mapping.TableMapping<T>
-
public final class TableMapping<T> extends Object
Holds mapping data from a given class and a table
-
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 protected org.nkjmlab.sorm4j.mapping.ColumnToAccessorMapcolumnToAccessorMapprotected Class<T>objectClassprotected ResultSetConverterresultSetConverter
-
メソッドの概要
すべてのメソッド staticメソッド インスタンス・メソッド concreteメソッド 修飾子とタイプ メソッド 説明 int[]batch(Connection con, String sql, Function<T,Object[]> parameterCreator, T[] objects)static <T> TableMapping<T>createMapping(ResultSetConverter sqlToJavaConverter, SqlParameterSetter javaToSqlConverter, Class<T> objectClass, String tableName, ColumnFieldMapper fieldMapper, org.nkjmlab.sorm4j.mapping.MultiRowProcessorGeneratorFactory batchConfig, Connection connection)intdelete(Connection connection, T object)Deletes an object in the database.int[]delete(Connection connection, T... objects)Updates a batch of objects in the database.intdeleteAll(Connection connection)List<String>getAllColumns()protected StringgetColumnToAccessorString()StringgetFormattedString()Object[]getParameters(Object object, List<String> columns)List<String>getPrimaryKeys()org.nkjmlab.sorm4j.mapping.SqlFromTableMappinggetSql()StringgetTableName()intinsert(Connection connection, T object)int[]insert(Connection con, T... objects)InsertResult<T>insertAndGet(Connection connection, T object)InsertResult<T>insertAndGet(Connection con, T... objects)intmerge(Connection connection, T object)int[]merge(Connection con, T... objects)voidthrowExeptionIfAutoGeneratedColumnsExist()voidthrowExeptionIfPrimaryKeysIsNotExist()StringtoString()intupdate(Connection connection, T object)Updates an object in the database.int[]update(Connection connection, T... objects)Updates a batch of objects in the database.
-
-
-
フィールドの詳細
-
objectClass
protected final Class<T> objectClass
-
resultSetConverter
protected final ResultSetConverter resultSetConverter
-
columnToAccessorMap
protected final org.nkjmlab.sorm4j.mapping.ColumnToAccessorMap columnToAccessorMap
-
-
メソッドの詳細
-
createMapping
public static final <T> TableMapping<T> createMapping(ResultSetConverter sqlToJavaConverter, SqlParameterSetter javaToSqlConverter, Class<T> objectClass, String tableName, ColumnFieldMapper fieldMapper, org.nkjmlab.sorm4j.mapping.MultiRowProcessorGeneratorFactory batchConfig, Connection connection) throws SQLException
- 例外:
SQLException
-
getTableName
public String getTableName()
-
getSql
public org.nkjmlab.sorm4j.mapping.SqlFromTableMapping getSql()
-
update
public int update(Connection connection, T object)
Updates an object in the database. The object will be identified using its mapped table's primary key. If no primary keys are defined in the mapped table, aRuntimeExceptionwill be thrown.
-
throwExeptionIfPrimaryKeysIsNotExist
public void throwExeptionIfPrimaryKeysIsNotExist()
-
throwExeptionIfAutoGeneratedColumnsExist
public void throwExeptionIfAutoGeneratedColumnsExist()
-
update
public int[] update(Connection connection, T... objects)
Updates a batch of objects in the database. The objects will be identified using their mapped table's primary keys. If no primary keys are defined in the mapped table, aRuntimeExceptionwill be thrown.
-
delete
public int delete(Connection connection, T object)
Deletes an object in the database. The object will be identified using its mapped table's primary key.
-
delete
public int[] delete(Connection connection, T... objects)
Updates a batch of objects in the database. The objects will be identified using their matched table's primary keys. If no primary keys are defined in a given object, a RuntimeException will be thrown.
-
deleteAll
public int deleteAll(Connection connection)
-
insert
public int insert(Connection connection, T object)
-
merge
public int merge(Connection connection, T object)
-
insertAndGet
public InsertResult<T> insertAndGet(Connection connection, T object)
-
insert
@SafeVarargs public final int[] insert(Connection con, T... objects)
-
insertAndGet
@SafeVarargs public final InsertResult<T> insertAndGet(Connection con, T... objects)
- パラメータ:
con-objects- not allownullor0length- 戻り値:
-
batch
public int[] batch(Connection con, String sql, Function<T,Object[]> parameterCreator, T[] objects)
-
merge
public int[] merge(Connection con, T... objects)
-
getFormattedString
public String getFormattedString()
-
getColumnToAccessorString
protected String getColumnToAccessorString()
-
-