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

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0036391
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] A. Platformminoralways2017-07-03 18:112017-09-21 16:49
ReporterngarciaView Statuspublic 
Assigned Toalostale 
PriorityhighResolutionfixedFixed in Version3.0PR17Q4
StatusclosedFix in branchFixed in SCM revision59f0b6944239
ProjectionnoneETAnoneTarget Version
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0036391: inconsistent behavior of OBDal.get by entity name + id when trying to populate a proxy by entity name + id

DescriptionWhen 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 Reproduce1. BusinessPartner bpProxy = (BusinessPartner) OBDal.getInstance().getProxy("BusinessPartner", "dummyId");
2. final BusinessPartner bpartner = (BusinessPartner) OBDal.getInstance().get("BusinessPartner", "dummyId");

Then, the query breaks if the object does not exist in DB.
Proposed SolutionAdd catch clause in OBDal class in get method:
  public BaseOBObject get(String entityName, Object id) {
    checkReadAccess(entityName);
    try {
      return SessionHandler.getInstance().find(entityName, id);
    } catch (ObjectNotFoundException ignore) {
      return null;
    }
  }
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]
related to defect 0034657 closedalostale inconsistent behavior of OBDal.get when trying to get an inexistent record  

-  Notes
(0097830)
hgbot (developer)
2017-07-04 11:21

Repository: erp/devel/pi
Changeset: 59f0b694423987416230f272f4164bc6f291c12c
Author: Asier Lostalé <asier.lostale <at> openbravo.com>
Date: Tue Jul 04 11:16:39 2017 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/59f0b694423987416230f272f4164bc6f291c12c [^]

fixed bug 36391: inconsistent behavior of OBDal.get getting an inexistent row

  When getting a DAL object by entity name + id that's already proxied in cache
  it throws a ObjectNotFoundException if it does not exist in DB. Standard API
  for OBDal.get methods is to return null in this case.

---
M src-test/src/org/openbravo/test/dal/DalTest.java
M src/org/openbravo/dal/service/OBDal.java
---
(0097850)
caristu (developer)
2017-07-04 20:09

Code reviewed + tested OK
(0099232)
hudsonbot (developer)
2017-09-21 16:49

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/9750b78d3e5c [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2017-07-03 18:11 ngarcia New Issue
2017-07-03 18:11 ngarcia Assigned To => platform
2017-07-03 18:11 ngarcia Modules => Core
2017-07-03 18:11 ngarcia Triggers an Emergency Pack => No
2017-07-03 18:11 ngarcia Issue generated from 0034657
2017-07-03 18:12 ngarcia Issue Monitored: networkb
2017-07-03 18:13 ngarcia Relationship added related to 0034657
2017-07-04 11:17 alostale Assigned To platform => alostale
2017-07-04 11:17 alostale Review Assigned To => caristu
2017-07-04 11:18 alostale Summary inconsistent behavior of OBDal.get when trying to get an inexistent record => inconsistent behavior of OBDal.get by entity name + id when trying to populate a proxy by entity name + id
2017-07-04 11:21 hgbot Checkin
2017-07-04 11:21 hgbot Note Added: 0097830
2017-07-04 11:21 hgbot Status new => resolved
2017-07-04 11:21 hgbot Resolution open => fixed
2017-07-04 11:21 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/59f0b694423987416230f272f4164bc6f291c12c [^]
2017-07-04 20:09 caristu Note Added: 0097850
2017-07-04 20:09 caristu Status resolved => closed
2017-07-04 20:09 caristu Fixed in Version => 3.0PR17Q4
2017-09-21 16:49 hudsonbot Checkin
2017-09-21 16:49 hudsonbot Note Added: 0099232


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker