Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0047750Openbravo ERPA. Platformpublic2021-09-23 12:422022-02-01 08:07
cberner 
Triage Platform Base 
normalmajorhave not tried
acknowledgedopen 
5
 
 
Core
No
0047750: Warning attempts to update an immutable entity M_Transaction when running hibernate with warn log
If running Openbravo with hibernate log level set to warning(we currently have it on error only) it will show up a warning related with updating an immutable entity. Check the provided warning from log.

Warning from log:
2021-08-20 11:39:05,353 [DefaultQuartzScheduler_Worker-1] WARN org.hibernate.internal.SessionImpl - HHH000487: The query: [ update MaterialMgmtMaterialTransaction as trx set trx.isProcessed = false where trx.isProcessed = true and trx.isCostCalculated = false and trx.costingStatus <> 'S' and trx.organization.id in (:orgs_0, :orgs_1, :orgs_2, :orgs_3, :orgs_4, :orgs_5, :orgs_6, :orgs_7, :orgs_8, :orgs_9, :orgs_10, :orgs_11)] attempts to update an immutable entity: [M_Transaction]
1. Modify log4j2-web.xml and set this property to warn, which previously was error:
<Logger name="org.hibernate" level="warn"/>
2. Run tomcat and check logs after a minute or so. That warning should appear in the log.

Alternatively:
1. Modify log4j2-web.xml and set this property to warn, which previously was error:
<Logger name="org.hibernate" level="warn"/>
2. Open backoffice and login.
3. Go to Process Request
4. Add a new row with process "Costing Background process" and Timing: "Run immediatly"
5. Save it and schedule it, you should be able to see the logged warning.
This is already reported to hibernate, we're waiting for a response on the status of the issue: https://hibernate.atlassian.net/browse/HHH-13860 [^] [^]

However, we do have a workaround for this issue in particular, instead of doing a mass update query through hibernate, we could as a solution, use sqlc like in the same CostingBackground file in InitializeCostingMTransCostDateacctData.initializeCostingMTransCostDateacct(cp.getConnection(), cp); line
No tags attached.
related to feature request 0045969 new Triage Platform Base upgrade to Hibernate 6.x (prototype) 
blocks design defect 0047873 acknowledged Triage Platform Base Set hibernate logging to warn or info level, instead of error only 
Issue History
2021-09-23 12:42cbernerNew Issue
2021-09-23 12:42cbernerAssigned To => platform
2021-09-23 12:42cbernerModules => Core
2021-09-23 12:42cbernerTriggers an Emergency Pack => No
2021-09-23 15:27shuehnerIssue Monitored: shuehner
2021-10-05 14:42cbernerSeverityminor => major
2021-10-08 12:30cbernerNote Added: 0132272
2021-10-13 14:26cbernerSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=23179#r23179
2021-10-13 14:26cbernerProposed Solution updated
2021-10-18 14:32cbernerNote Added: 0132414
2021-10-18 14:32cbernerStatusnew => acknowledged
2021-10-18 14:45cbernerTypedefect => design defect
2021-10-18 14:45cbernerRelationship addedrelated to 0045969
2021-10-18 14:59cbernerRelationship addedblocks 0047873
2022-02-01 08:07alostaleAssigned Toplatform => Triage Platform Base

Notes
(0132272)
cberner   
2021-10-08 12:30   
This warning seems to be due to how we handle computed columns. We have 2 hibernate mapping classes when we define computed columns. For example: Order and Order_ComputedColumns, first one is mutable and the second one is read-only immutable. It seems that using Hibernate update hql queries through session.createQuery API results in the warning, because it checks both the first class, and also the class of the computed columns, although we don't modify any property on that second class.

This is already reported to hibernate, we're waiting for a response on the status of the issue: https://hibernate.atlassian.net/browse/HHH-13860 [^]

However, we do have a workaround for this issue in particular, instead of doing a mass update query through hibernate, we could as a solution, use sqlc like in the same CostingBackground file in InitializeCostingMTransCostDateacctData.initializeCostingMTransCostDateacct(cp.getConnection(), cp); line
(0132414)
cberner   
2021-10-18 14:32   
After talking with vmromanos, they'll probably remove the CostingBackground process in the near future, as such, we're marking this issue as aknowledged, waiting for 2 things:

1. Removal of CostingBackground process, and recheck that the warning doesn't exist anymore.
2. Fix from hibernate to this warning, when done update and recheck for this warning.

Whatever happens first, this issue should be rechecked.