クラス 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 ColumnToAccessorMapcolumnToAccessorMapprotected Class<T>objectClassprotected ResultSetConvertersqlToJavaConverter
-
メソッドの概要
すべてのメソッド staticメソッド インスタンス・メソッド concreteメソッド 修飾子とタイプ メソッド 説明 int[]batch(Connection con, String sql, Function<T,Object[]> parameterCreator, T[] objects)protected Map<String,org.nkjmlab.sorm4j.mapping.Accessor>createAccessors(List<Column> columns, ColumnFieldMapper nameGuesser)static <T> TableMapping<T>createMapping(ResultSetConverter sqlToJavaConverter, PreparedStatementParametersSetter javaToSqlConverter, Class<T> objectClass, String tableName, ColumnFieldMapper fieldMapper, MultiRowProcessorFactory 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()static Map<FieldName,Field>getAllFields(Class<?> objectClass)protected StringgetColumnToAccessorString()StringgetFormattedString()Object[]getParameters(Object object, List<String> columns)List<String>getPrimaryKeys()SqlFromTableMappinggetSql()StringgetTableName()intinsert(Connection connection, T object)int[]insert(Connection con, T... objects)InsertResult<T>insertAndGetResult(Connection connection, T object)InsertResult<T>insertAndGetResult(Connection con, T... objects)intmerge(Connection connection, T object)int[]merge(Connection con, T... objects)List<String>notAutoGeneratedColumns()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.
-
-
-
フィールドの詳細
-
sqlToJavaConverter
protected final ResultSetConverter sqlToJavaConverter
-
objectClass
protected final Class<T> objectClass
-
columnToAccessorMap
protected final ColumnToAccessorMap columnToAccessorMap
-
-
メソッドの詳細
-
createMapping
public static final <T> TableMapping<T> createMapping(ResultSetConverter sqlToJavaConverter, PreparedStatementParametersSetter javaToSqlConverter, Class<T> objectClass, String tableName, ColumnFieldMapper fieldMapper, MultiRowProcessorFactory batchConfig, Connection connection)
-
getTableName
public String getTableName()
-
getSql
public 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.- 導入されたバージョン:
- 1.0
-
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.- 導入されたバージョン:
- 1.0
-
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.- 導入されたバージョン:
- 1.0
-
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.- 導入されたバージョン:
- 1.0
-
deleteAll
public int deleteAll(Connection connection)
-
insert
public int insert(Connection connection, T object)
-
merge
public int merge(Connection connection, T object)
-
insertAndGetResult
public InsertResult<T> insertAndGetResult(Connection connection, T object)
-
insert
@SafeVarargs public final int[] insert(Connection con, T... objects)
-
insertAndGetResult
@SafeVarargs public final InsertResult<T> insertAndGetResult(Connection con, T... objects)
-
batch
public int[] batch(Connection con, String sql, Function<T,Object[]> parameterCreator, T[] objects)
-
merge
public int[] merge(Connection con, T... objects)
-
toString
public String toString()
-
getFormattedString
public String getFormattedString()
-
createAccessors
protected Map<String,org.nkjmlab.sorm4j.mapping.Accessor> createAccessors(List<Column> columns, ColumnFieldMapper nameGuesser)
-
getColumnToAccessorString
protected String getColumnToAccessorString()
-
-