Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0046647
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagerminoralways2021-05-12 15:582021-06-04 11:47
ReportermarvintmView Statuspublic 
Assigned Toalostale 
PrioritynormalResolutionfixedFixed in VersionPR21Q3
StatusclosedFix in branchFixed in SCM revision
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned To
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0046647: Neither onCreateDefault nor default values are used when inserting sampledata

DescriptionCurrently, neither onCreateDefault nor default values are used when inserting sampledata, for mandatory columns in client/org records.

This means that sampledata import is currently quite fragile, because if later on a new module adding a mandatory column is installed, the same sampledata cannot be used unless the data definition is updated with values for that column.

It currently also impacts us in the development of the new POS, because we are trying to use the same sampledata we had in the old POS, and we also want to add mandatory columns (with their corresponding default) to the new POS modules.
Steps To Reproduce- Create some sampledata records for a set of modules
- Install a new module which adds a mandatory column with a default/oncreatedefault value.
- Do install.source. Realise that it fails because the record is being inserted without value in this mandatory column.
Proposed SolutionProbably either oncreatedefault or default should be used, if when inserting a record the value of a column is null, the column is mandatory, and it contains a default or oncreatedefault.

Most probably the behaviour we have for sourcedata should be replicated here. Originally, oncreatedefault value was used for this, but this may have changed in recent years.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0049897PR22Q4 closedalostale Add missing support for referencing other columns in onCreateDefault during importsampledata 

-  Notes
(0128813)
hgbot (developer)
2021-05-31 13:30

Merge Request created: https://gitlab.com/openbravo/product/dbsm/-/merge_requests/25 [^]
(0129058)
hgbot (developer)
2021-06-04 10:51

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/dbsm [^]
Changeset: 83897056d170385c18fe163b8d5465ccc3eae8c4
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 2021-06-04T10:47:42+02:00
URL: https://gitlab.com/openbravo/product/dbsm/-/commit/83897056d170385c18fe163b8d5465ccc3eae8c4 [^]

fixes BUG-46647: no default applied when inserting sample data

When inserting sample data neither default or on create default were
applied. This made more difficult to import sample data in an instance
with a different set of modules than the ones used to generate it.

Now when trying to import sample data with null values in mandatory columns
the following is applied:

 * If there is an on create default literal value it gets applied. Note on
   create default based on subqueries cannot be applied.
 * If there is no create default, default value gets applied.

---
A src-test/data/sampledata/NO_REQ1.xml
A src-test/data/sampledata/NO_REQ2.xml
A src-test/data/sampledata/NO_REQ3.xml
A src-test/data/sampledata/OPT_NULL.xml
A src-test/data/sampledata/SIMPLE.xml
A src-test/data/sampledata/UNKNOWN_COL.xml
A src-test/model/sampledata/SAMPLE_DATA_MODEL.xml
A src-test/src/org/openbravo/dbsm/test/sampledata/ImportSampleData.java
A src-test/src/org/openbravo/dbsm/test/sampledata/SampleDataSuite.java
M src-test/src/org/openbravo/dbsm/test/DBSMTestSuite.java
M src-test/src/org/openbravo/dbsm/test/base/DbsmTest.java
M src/org/apache/ddlutils/io/DataToDatabaseSink.java
M src/org/openbravo/ddlutils/task/ImportSampledata.java
---
(0129059)
hgbot (developer)
2021-06-04 10:51

Merge request merged: https://gitlab.com/openbravo/product/dbsm/-/merge_requests/25 [^]
(0129068)
hgbot (developer)
2021-06-04 11:47

Directly closing issue as related merge request is already approved.

Repository: https://gitlab.com/openbravo/product/openbravo [^]
Changeset: 870040145e6772c5c7a8a689055a6f6f2d53775a
Author: Asier Lostalé <asier.lostale@openbravo.com>
Date: 2021-06-04T10:55:51+02:00
URL: https://gitlab.com/openbravo/product/openbravo/-/commit/870040145e6772c5c7a8a689055a6f6f2d53775a [^]

fixes BUG-46974: core2 tables export; fixes BUG-46647: sampledata defaults

dbsm including the fixes for:

BUG-46974: cannot export data of tables from core2

  Source data in core2 AD tables was not exported. ISSUE-46245 skips
  export of these tables in case the module that defines them is not
  installed.

  When exporting source data it was not working because it incorrectly
  dected core2 to be always not installed. It relied on
  DBSMOBUtil.allModules to be correctly completelly initialized which is
  not the case after calling getSortedTemplates.

  Now the optional modules not installed are initialized in getModules and
  kept after getSortedTemplates. belongsToOptionalUninstalledModule method
  must be invoked after getModules, now if called before it will
  explicitily fail.

BUG-46647: no default applied when inserting sample data

  When inserting sample data neither default or on create default were
  applied. This made more difficult to import sample data in an instance
  with a different set of modules than the ones used to generate it.

  Now when trying to import sample data with null values in mandatory columns
  the following is applied:

   * If there is an on create default literal value it gets applied. Note on
     create default based on subqueries cannot be applied.
   * If there is no create default, default value gets applied.

---
M src-db/database/lib/dbsourcemanager.jar
---

- Issue History
Date Modified Username Field Change
2021-05-12 15:58 marvintm New Issue
2021-05-12 15:58 marvintm Assigned To => platform
2021-05-12 15:58 marvintm Modules => Core
2021-05-12 15:58 marvintm Triggers an Emergency Pack => No
2021-05-25 16:00 shuehner Issue Monitored: shuehner
2021-05-31 13:26 alostale Assigned To platform => alostale
2021-05-31 13:30 hgbot Note Added: 0128813
2021-06-04 10:51 hgbot Resolution open => fixed
2021-06-04 10:51 hgbot Status new => closed
2021-06-04 10:51 hgbot Note Added: 0129058
2021-06-04 10:51 hgbot Note Added: 0129059
2021-06-04 11:47 hgbot Fixed in Version => PR21Q3
2021-06-04 11:47 hgbot Note Added: 0129068
2022-11-18 09:23 caristu Relationship added related to 0049897


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker