クラス TableMapping<T>


  • public final class TableMapping<T>
    extends Object
    Holds mapping data from a given class and a table
    • フィールドの詳細

      • objectClass

        protected final Class<T> objectClass
      • columnToAccessorMap

        protected final org.nkjmlab.sorm4j.mapping.ColumnToAccessorMap columnToAccessorMap
    • メソッドの詳細

      • getTableName

        public String getTableName()
      • getAllColumns

        public List<String> getAllColumns()
      • getPrimaryKeys

        public List<String> getPrimaryKeys()
      • 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, a RuntimeException will 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, a RuntimeException will 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)
      • merge

        public int[] merge​(Connection con,
                           T... objects)
      • getFormattedString

        public String getFormattedString()
      • getColumnToAccessorString

        protected String getColumnToAccessorString()