on some condition, record insert by direct sql missing UUID
Description
Environment
Attachments
- 01 May 2020, 03:31 PM
duplicates
relates to
Activity
Copying here the list of classes discovered in IDEMPIERE-811:
Found that some classes are doing direct INSERT INTO without filling the UU column, like:
org.compiere.model.MDocType -> AD_Document_Action_Access
org.compiere.model.MLanguage -> tableName
org.compiere.model.MPInstanceLog -> AD_PInstance_Log
org.compiere.model.MProcessPara -> AD_Process_Para_Trl
org.compiere.model.MRole -> AD_Window_Access AD_Process_Access AD_Form_Access AD_WorkFlow_Access AD_Document_Action_Access
(unused code ) org.compiere.model.TranslationTable -> trltable
org.compiere.print.PrintUtil -> AD_PrintForm
org.compiere.process.FactReconcile -> Fact_Reconciliation T_Reconciliation
org.compiere.process.ProcessInfoUtil -> AD_PInstance_Log
org.compiere.process.AcctSchemaDefaultCopy -> M_Product_Acct ... and samely the other account default copy processes
org.compiere.process.ImportProduct -> M_Product_PO
org.compiere.process.InventoryCountCreate -> M_StorageOnHand
org.compiere.process.M_PriceList_Create -> M_ProductPrice
org.compiere.process.SynchronizeTerminology -> AD_ELEMENT_TRL
(changed, not anymore) org.adempiere.webui.dashboard.DPFavourites -> AD_TreeBar
org.adempiere.webui.ValuePreference -> AD_Preference
... there are more ...
thanks @Carlos Ruiz for point out that.
just saw "we can keep what’s in java now" save us from log migrate script for UUID issue
From what I understand, if we plan to make all _UU columns mandatory with default generate_uuid(), then I think the ticket would require the following changes:
change the UUIDGenerator process to generate the new columns with these new properties
I think it's better also if the UUIDGenerator process can check the old _UU generated columns and change them accordingly
a migration script that changes all the actual columns (this can be generated automatically after the UUID Generator does the work proposed in second bullet
change the MColumn.setSmartDefaults and Callout_AD_Column.columnName to set these properties too
we can add default to all uuid column (with mandatory) and don't change java code. because value setter from java code override default value. add to all uuid column get more advance
example: table ad_column somewhere on code now already handle uuid by "insert ad_column (ad_column_uuid)" but on future maybe insert ad_column forget setter uuid then default value will handle it
Yeah, that default sounds fine to me.
It is only use when the java code is not doing it so that doesn’t sounds like any sort of conflict to me - we can keep what’s in java now and add default clause for UU column (should be mandatory with default).
it's better to add generate_uuid() to default logic of UU column and delete manual insert uuid from code
but at moment just follow old method by add generate_uuid on insert command