[ https://issues.apache.org/jira/browse/FINERACT-2091?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17853693#comment-17853693 ]
Peter Santa edited comment on FINERACT-2091 at 6/10/24 2:23 PM: ---------------------------------------------------------------- *part 1 - generic Auditable interface* Jankovics Márta h3. 2 days ago Edited Why do we need support for String type primary keys? Because * generating a String type key is much faster than calculate the incremental next decimal value * Stateless, it can be generated on the fly * already known before the entity is saved * globally unique: different entities and distributed systems, hosts/tenants could not produce exactly the same value * sense of security since the malicious users can't guess the ID * we advise to use nanoId, because it is tiny, secure, URL-friendly, cryptographically strong, has no mandatory dependencies, 60% faster than UUID and we can control the behaviour of alphabets to be used * disadvantages: * ** not naturally sortable according to creation time - for that we introduced {{created_on_utc}} with nanoseconds * ** less user readable - suggest to have a user friendly name instead the primary key What has changed? part 1: * {{AbstractPersistableCustom}} interface generic type id: T extends Serializable - instead of Long this change effects all entity codes but transparent for the users part 2: * general APIs like command, datatables, journal entries and notes are now working with Serializable keys (not only Long) * general services of command, datatables, journal entries and notes were extended to handle Serializable keys * enum type response data EnumOptionData is also generic and has a special {{StringEnumOptionData}} * model extensions, new columns to store string type ids: * ** {{{}m_portfolio_command_source{}}}.{{{}resource_identifier{}}} {{varchar(100)}} * ** {{acc_product_mapping.product_identifier}} {{char(21)}} * ** {{{}m_note{}}}.{{{}entity_identifier{}}} {{varchar(40)}} * dependency of {{com.aventrix.jnanoid:jnanoid:2.0.0}} was (Author: peter.santa): Jankovics Márta h3. 2 days ago Edited Why do we need support for String type primary keys? Because * generating a String type key is much faster than calculate the incremental next decimal value * Stateless, it can be generated on the fly * already known before the entity is saved * globally unique: different entities and distributed systems, hosts/tenants could not produce exactly the same value * sense of security since the malicious users can't guess the ID * we advise to use nanoId, because it is tiny, secure, URL-friendly, cryptographically strong, has no mandatory dependencies, 60% faster than UUID and we can control the behaviour of alphabets to be used * disadvantages: ** not naturally sortable according to creation time - for that we introduced {{created_on_utc}} with nanoseconds ** less user readable - suggest to have a user friendly name instead the primary key What has changed? part 1: * {{AbstractPersistableCustom}} interface generic type id: T extends Serializable - instead of Long this change effects all entity codes but transparent for the users part 2: * general APIs like command, datatables, journal entries and notes are now working with Serializable keys (not only Long) * general services of command, datatables, journal entries and notes were extended to handle Serializable keys * enum type response data EnumOptionData is also generic and has a special {{StringEnumOptionData}} * model extensions, new columns to store string type ids: ** {{{}m_portfolio_command_source{}}}.{{{}resource_identifier{}}} {{varchar(100)}} ** {{acc_product_mapping.product_identifier}} {{char(21)}} ** {{{}m_note{}}}.{{{}entity_identifier{}}} {{varchar(40)}} * dependency of {{com.aventrix.jnanoid:jnanoid:2.0.0}} > Support for string type primary keys - part 1 > --------------------------------------------- > > Key: FINERACT-2091 > URL: https://issues.apache.org/jira/browse/FINERACT-2091 > Project: Apache Fineract > Issue Type: Improvement > Reporter: Peter Santa > Priority: Major > Labels: BeanSalad > -- This message was sent by Atlassian Jira (v8.20.10#820010)