Hi all, I’ve raised a PR to enhance datatable behaviour.
https://github.com/apache/fineract/pull/3364 <https://github.com/apache/fineract/pull/3364> Please review general changes for data tables. Make the datatable read/write actions more type safe. Instead of reading and comparing string literals as database types, eg. ResultsetColumnHeaderData public boolean isDateTimeDisplayType() { return "DATETIME".equalsIgnoreCase(this.columnDisplayType); } changed to type safe enums public boolean isDateTimeDisplayType() { return columnDisplayType == DisplayType.DATETIME; } In order to fulfil this, there were new types introduced org.apache.fineract.infrastructure.core.service.database.JdbcJavaType org.apache.fineract.infrastructure.core.service.database.JavaType These enums are able to recognise/compare/parse/format database types for the currently supported database dialects: mysql, postgresql, and can be extended to other dialects on need. Some code could be still more enhanced, like ResultsetColumnHeaderData.adjustColumnType Availability to connect data tables to the application table by a configurable database field instead of the application table generated primary key. Reason: Datatable support was added for Savings Transactions, but the generated key of the transactions could be invalidated on Savings Account reschedule. (Old transactions could be replaced by new transactions with different primary keys). To keep the referential integrity, there is a need to link the datatables for this entity through an external key (which never changes). First step to support this was to add new property to org.apache.fineract.infrastructure.dataqueries.data.EntityTables private final String refColumn; // referenced column name on apptable Add new property in EntityTables This way it is possible to introduce several entity types mapped to the same application table (GROUP/CENTER) private final String apptableName; Additionally we made sure that everywhere in the code the string based logic was replaced by the use of EntityTables if ("m_center".equalsIgnoreCase(appTable)) to EntityTables.CENTER == appTable Utility classes org.apache.fineract.infrastructure.core.service.MathUtil org.apache.fineract.infrastructure.core.service.DateUtils were moved to common packages and extended by new util methods. Some of the new methods are not used yet, but during the code clean-up we would like to use these utils more and more. Validation and sql build support methods added : org.apache.fineract.infrastructure.core.service.database.DatabaseSpecificSQLGenerator Support for generic search: org.apache.fineract.infrastructure.core.service.database.SqlOperator org.apache.fineract.portfolio.search.service.SearchUtil Enhanced existing unit/integration tests: org.apache.fineract.infrastructure.dataqueries.service.ReadWriteNonCoreDataServiceImplTest.java org.apache.fineract.integrationtests.datatable.DatatableIntegrationTest.java org.apache.fineract.integrationtests.common.organisation.EntityDatatableChecksIntegrationTest.java Regards, Marta Jankovics