Project:
| View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | ||||||||
| 0034657 | ||||||||
| Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
| defect | [Openbravo ERP] A. Platform | major | always | 2016-11-30 16:49 | 2017-07-03 18:11 | |||
| Reporter | kchoperena | View Status | public | |||||
| Assigned To | alostale | |||||||
| Priority | urgent | Resolution | fixed | Fixed in Version | 3.0PR17Q1 | |||
| Status | closed | Fix in branch | Fixed in SCM revision | 72cd92b69d62 | ||||
| Projection | none | ETA | none | Target Version | ||||
| OS | Any | Database | Any | Java version | ||||
| OS Version | Database version | Ant version | ||||||
| Product Version | SCM revision | |||||||
| 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; } } | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Relationships [ Relation Graph ]
[ Dependency Graph ]
|
||||||||
|
||||||||
Notes |
|
|
(0091980) hgbot (developer) 2016-12-01 16:11 |
Repository: erp/devel/pi Changeset: 72cd92b69d6292e4933c46b43d916ffb900604fc Author: Asier Lostalé <asier.lostale <at> openbravo.com> Date: Thu Dec 01 16:10:42 2016 +0100 URL: http://code.openbravo.com/erp/devel/pi/rev/72cd92b69d6292e4933c46b43d916ffb900604fc [^] fixed bug 34657: inconsistent behavior of OBDal.get OBDal.get behaved inconsistently when trying to obtain an object for an ID that is not present in DB: -It usually returns null -unless there was a proxy for the same object, which thrown an exception Fixed by making it to always return null in this case. --- M src-test/src/org/openbravo/test/dal/DalTest.java M src/org/openbravo/dal/service/OBDal.java --- |
|
(0092044) caristu (viewer) 2016-12-02 15:40 |
Code review + testing OK. |
|
(0092680) hudsonbot (viewer) 2016-12-16 18:39 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/dc8bf00badd0 [^] Maturity status: Test |
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 | View Revisions |
| 2016-12-01 16:06 | alostale | Steps to Reproduce Updated | View Revisions |
| 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 |
| Copyright © 2000 - 2009 MantisBT Group |