Openbravo Issue Tracking System - Openbravo ERP | ||||||||||||
View Issue Details | ||||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||||
0034657 | Openbravo ERP | A. Platform | public | 2016-11-30 16:49 | 2017-07-03 18:11 | |||||||
Reporter | kchoperena | |||||||||||
Assigned To | alostale | |||||||||||
Priority | urgent | Severity | major | Reproducibility | always | |||||||
Status | closed | Resolution | fixed | |||||||||
Platform | OS | 5 | OS Version | |||||||||
Product Version | ||||||||||||
Target Version | Fixed in Version | 3.0PR17Q1 | ||||||||||
Merge Request Status | ||||||||||||
Review Assigned To | caristu | |||||||||||
OBNetwork customer | No | |||||||||||
Web browser | ||||||||||||
Modules | Core | |||||||||||
Support ticket | ||||||||||||
Regression level | ||||||||||||
Regression date | ||||||||||||
Regression introduced in release | ||||||||||||
Regression introduced by commit | ||||||||||||
Triggers an Emergency Pack | No | |||||||||||
Summary | 0034657: inconsistent behavior of OBDal.get when trying to get an inexistent record | |||||||||||
Description | When OBDal.get is used to get a record which ID does not exist in DB, it returns null. Previous statement is true as far as there was not a proxy for the same object in Hibernate cache, in this case an ObjectNotFoundException is thrown. | |||||||||||
Steps To Reproduce | 1. BusinessPartner bpProxy = OBDal.getInstance().getProxy(BusinessPartner.class, "dummyId"); 2. final BusinessPartner bpartner = OBDal.getInstance().get(BusinessPartner.class, "dummyId"); Then, the query breaks if the object does not exist in DB. Workaround: If we use "OBDal.getInstance().getSession().evict(bpProxy);" sentence before make the query, it works succesfully | |||||||||||
Proposed Solution | Add catch clause in OBDal class in get method: public <T extends Object> T get(Class<T> clazz, Object id) { checkReadAccess(clazz); try { return SessionHandler.getInstance().find(clazz, id); } catch (org.hibernate.ObjectNotFoundException e) { return null; } } | |||||||||||
Additional Information | ||||||||||||
Tags | No tags attached. | |||||||||||
Relationships |
| |||||||||||
Attached Files | ![]() https://issues.openbravo.com/file_download.php?file_id=10133&type=bug | |||||||||||
Issue History | ||||||||||||
Date Modified | Username | Field | Change | |||||||||
2016-11-30 16:49 | kchoperena | New Issue | ||||||||||
2016-11-30 16:49 | kchoperena | Assigned To | => alostale | |||||||||
2016-11-30 16:49 | kchoperena | File Added: OBDalPatch.diff | ||||||||||
2016-11-30 16:49 | kchoperena | OBNetwork customer | => No | |||||||||
2016-11-30 16:49 | kchoperena | Modules | => Core | |||||||||
2016-11-30 16:49 | kchoperena | Triggers an Emergency Pack | => No | |||||||||
2016-11-30 17:39 | alostale | Assigned To | alostale => platform | |||||||||
2016-11-30 17:39 | alostale | Status | new => acknowledged | |||||||||
2016-11-30 17:39 | alostale | Category | Y. DBSourceManager => A. Platform | |||||||||
2016-12-01 13:17 | alostale | Priority | normal => urgent | |||||||||
2016-12-01 14:14 | alostale | Status | acknowledged => scheduled | |||||||||
2016-12-01 14:14 | alostale | Assigned To | platform => alostale | |||||||||
2016-12-01 16:06 | alostale | Summary | When we try to make a query of any object that not exist in DB but we have a proxy opened before, the query breaks => inconsistent behavior of OBDal.get when trying to get an inexistent record | |||||||||
2016-12-01 16:06 | alostale | Description Updated | bug_revision_view_page.php?rev_id=13928#r13928 | |||||||||
2016-12-01 16:06 | alostale | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=13930#r13930 | |||||||||
2016-12-01 16:06 | alostale | Review Assigned To | => caristu | |||||||||
2016-12-01 16:11 | hgbot | Checkin | ||||||||||
2016-12-01 16:11 | hgbot | Note Added: 0091980 | ||||||||||
2016-12-01 16:11 | hgbot | Status | scheduled => resolved | |||||||||
2016-12-01 16:11 | hgbot | Resolution | open => fixed | |||||||||
2016-12-01 16:11 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/72cd92b69d6292e4933c46b43d916ffb900604fc [^] | |||||||||
2016-12-02 15:40 | caristu | Note Added: 0092044 | ||||||||||
2016-12-02 15:40 | caristu | Status | resolved => closed | |||||||||
2016-12-02 15:40 | caristu | Fixed in Version | => 3.0PR17Q1 | |||||||||
2016-12-16 18:39 | hudsonbot | Checkin | ||||||||||
2016-12-16 18:39 | hudsonbot | Note Added: 0092680 | ||||||||||
2017-07-03 18:11 | ngarcia | Issue cloned | 0036391 | |||||||||
2017-07-03 18:13 | ngarcia | Relationship added | related to 0036391 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|