Anonymous | Login
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Modules] Advanced Paymentsmajoralways2019-07-01 19:182019-08-22 14:45
ReportermartinsdanView Statuspublic 
Assigned Todmiguelez 
PrioritynormalResolutionfixedFixed in Version
StatusclosedFix in branchFixed in SCM revision89ffba6ba6bf
ProjectionnoneETAnoneTarget Version
OSLinux 64 bitDatabasePostgreSQLJava version11
OS Version18.01Database version9.5Ant version
Product VersionSCM revision 
Regression date
Regression introduced by commit
Regression level
Review Assigned Todmiguelez
Regression introduced in release

0041215: Error using FIN_Utility.getDocumentNo in an event handler

DescriptionAn error occurs when FIN_Utility.getDocumentNo is called for a sequence that is referenced in the entity being saved.
When this is done, an NPE will happen in hibernate.

2019-07-01 17:50:38,961 [http-nio-8080-exec-3] ERROR org.openbravo.service.json.DefaultJsonDataService - Error updating object
java.lang.NullPointerException: null
    at ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.type.AbstractStandardBasicType.getHashCode( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.type.AbstractStandardBasicType.getHashCode( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.engine.spi.CollectionKey.generateHashCode( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.engine.spi.CollectionKey.<init>( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.engine.spi.CollectionKey.<init>( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.AbstractFlushingEventListener.postFlush( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.event.internal.DefaultFlushEventListener.onFlush( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.internal.SessionImpl.doFlush( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.hibernate.internal.SessionImpl.flush( ~[hibernate-core-5.3.2.Final.jar:5.3.2.Final]
    at org.openbravo.dal.service.OBDal.flush( ~[classes/:?]
    at org.openbravo.service.json.DefaultJsonDataService.update( [classes/:?]
    at org.openbravo.service.datasource.DefaultDataSourceService.update( [classes/:?]
    at org.openbravo.service.datasource.DataSourceServlet.doPut( [classes/:?]
Steps To Reproduce- Add a sequence field in Product.
- Create an event handler for Product
- On save, call FIN_Utility.getDocumentNo and set the current state of the search key

The error will be shown
Proposed SolutionThe problem is related to the call of lockSequence(seq) in getDocumentNo.
I think the specific problem is OBDal.getInstance().getSession().evict(seq).

TagsNo tags attached.
Attached Files? file icon [^] (2,516 bytes) 2019-07-02 12:51

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
AugustoMauch (developer)
2019-07-25 17:08

I have not been able to reproduce the issue in a clean pi environment after:
- Adding a new field to m_product that references an ad_sequence
- Adding an event handler to product trying both:
    * directly evicting its ad_sequence when the product is saved
    * calling FIN_Utility.getDocumentNo, which implicitely will end up evicting the sequence.

In all cases the update was done properly.

In the client test environment the issue was reproducible, unless the eviction of the sequence [1] was commented out.

Is this eviction needed? This other method [1] that locks an order does not need to evict is from the hibernate session.

[1] [^]
[2] [^]
dmiguelez (developer)
2019-07-31 12:49

Test plan.

It has not been possible to reproduce this issue locally due to the lack of the customization code and client's data.

It has been tested in the client and the related automated tests have been executed successfully.
hgbot (developer)
2019-08-08 08:26

Repository: erp/devel/pi
Changeset: 89ffba6ba6bf5d3b7d82b54c889de99a12e54f39
Author: Armaignac <collazoandy4 <at>>
Date: Wed Jul 31 12:46:44 2019 +0200
URL: [^]

Fixes issue 41215:Error using FIN_Utility.getDocumentNo in an event handler

An error occurs when FIN_Utility.getDocumentNo is called for a sequence that is
referenced in the entity being saved. When this is done, an NPE will happen in hibernate.

The problem is related to the call of lockSequence(seq) in getDocumentNo.
The specific problem is OBDal.getInstance().getSession().evict(seq)

The evict call was removed and also some code refactor was done

M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/
dmiguelez (developer)
2019-08-08 08:26

Code Review + Testing Ok
hudsonbot (developer)
2019-08-22 14:45

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2019-07-01 19:18 martinsdan New Issue
2019-07-01 19:18 martinsdan Assigned To => Triage Finance
2019-07-02 12:49 santi_lozano Resolution time => 1563832800
2019-07-02 12:51 santi_lozano File Added:
2019-07-02 13:02 egoitz Assigned To Triage Finance => platform
2019-07-02 13:03 egoitz Severity minor => major
2019-07-17 11:00 martinsdan Issue Monitored: martinsdan
2019-07-25 17:08 AugustoMauch Note Added: 0113650
2019-07-25 17:08 AugustoMauch Status new => feedback
2019-07-25 17:08 AugustoMauch Assigned To platform => martinsdan
2019-07-25 17:45 AugustoMauch Assigned To martinsdan => Triage Finance
2019-07-31 12:49 dmiguelez Note Added: 0113733
2019-08-06 11:54 Sandrahuguet Assigned To Triage Finance => dmiguelez
2019-08-08 08:26 hgbot Checkin
2019-08-08 08:26 hgbot Note Added: 0113892
2019-08-08 08:26 hgbot Status feedback => resolved
2019-08-08 08:26 hgbot Resolution open => fixed
2019-08-08 08:26 hgbot Fixed in SCM revision => [^]
2019-08-08 08:26 dmiguelez Review Assigned To => dmiguelez
2019-08-08 08:26 dmiguelez Note Added: 0113893
2019-08-08 08:26 dmiguelez Status resolved => closed
2019-08-22 14:45 hudsonbot Checkin
2019-08-22 14:45 hudsonbot Note Added: 0114217

Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker