Openbravo Issue Tracking System - Retail Modules
View Issue Details
0035645Retail ModulesStoreServerpublic2017-03-29 19:162017-03-30 16:32
AugustoMauch 
AugustoMauch 
normalmajorhave not tried
closedfixed 
5
 
RR17Q2 
mtaal
No
0035645: Prevent invoking a commitAndClose inside an event handler
The OrderEventHandler class [1] invokes the MobileServerProvider.getInstance().getMobileServersForOrganization(organizationId) method to fetch the list of servers with access to that organization. The problem is that the getMobileServersForOrganization ends up invoking commitAndClose [2] if its cache has not been initialized.

Error log:

69315 [http-bio-8070-exec-9] WARN org.openbravo.dal.core.OBInterceptor - The object GCNV_GiftCardInst(18EFFD272CF8464790497CD1456CA6B7) (searchKey: Test, type: BasedOnProductGiftCard) is detected as not new (is its id != null?) but it does not have a current state in the database. This can happen when the id is set but not setNewObject(true); has been called.
69321 [http-bio-8070-exec-9] ERROR org.hibernate.jdbc.AbstractBatcher - Exception executing batch:
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1
    at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched(Expectations.java:85)
    at org.hibernate.jdbc.Expectations$BasicExpectation.verifyOutcome(Expectations.java:70)
    at org.hibernate.jdbc.BatchingBatcher.checkRowCounts(BatchingBatcher.java:90)
    at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)
    at org.hibernate.jdbc.AbstractBatcher.executeBatch(AbstractBatcher.java:268)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:268)
    at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:185)
    at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
    at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216)
    at org.openbravo.dal.service.OBDal.flush(OBDal.java:260)
    at org.openbravo.dal.core.SessionHandler.flushRemainingChanges(SessionHandler.java:680)
    at org.openbravo.dal.core.SessionHandler.commitAndClose(SessionHandler.java:592)
    at org.openbravo.dal.service.OBDal.commitAndClose(OBDal.java:223)
    at org.openbravo.replication.symmetricds.util.MobileServerProvider.initializeDataCachedByOrganization(MobileServerProvider.java:231)
[1] https://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/file/f982c1ca4b6c/src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrderEventHandler.java#l152 [^]
[2]
In a central server without SymmetricDS installed, create a giftcard instance. If the MobileServerProvider cache is not initialized, the error will be shown and the giftcard instance will not be created.
No tags attached.
related to defect 0034465 closed AugustoMauch Initialize.bp.segmentation.tables does not take into account BPartners of gift card instances 
Issue History
2017-03-29 19:16AugustoMauchNew Issue
2017-03-29 19:16AugustoMauchAssigned To => AugustoMauch
2017-03-29 19:16AugustoMauchTriggers an Emergency Pack => No
2017-03-29 19:20hgbotCheckin
2017-03-29 19:20hgbotNote Added: 0095676
2017-03-29 19:20hgbotStatusnew => resolved
2017-03-29 19:20hgbotResolutionopen => fixed
2017-03-29 19:20hgbotFixed in SCM revision => http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/36a93cba93a55b2c611fa6a5af622e5112a89f44 [^]
2017-03-29 19:23hgbotCheckin
2017-03-29 19:23hgbotNote Added: 0095677
2017-03-29 19:23hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/36a93cba93a55b2c611fa6a5af622e5112a89f44 [^] => http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/3f81060a571b5957586ce77702b27075277b325e [^]
2017-03-29 19:23AugustoMauchReview Assigned To => mtaal
2017-03-29 19:25AugustoMauchRelationship addedrelated to 0034465
2017-03-30 16:32mtaalNote Added: 0095724
2017-03-30 16:32mtaalStatusresolved => closed
2017-03-30 16:32mtaalFixed in Version => RR17Q2

Notes
(0095676)
hgbot   
2017-03-29 19:20   
Repository: erp/pmods/org.openbravo.replication.symmetricds
Changeset: 36a93cba93a55b2c611fa6a5af622e5112a89f44
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Mar 29 19:18:56 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.replication.symmetricds/rev/36a93cba93a55b2c611fa6a5af622e5112a89f44 [^]

Fixes issue 35645: Allow to initialize cache without transaction commit

The two caches of MobileServerProvider now can be initialized with or without a transaction commit. By default they will be initialized committing the transaction, to preserve the current behaviour.

---
M src/org/openbravo/replication/symmetricds/util/MobileServerProvider.java
---
(0095677)
hgbot   
2017-03-29 19:23   
Repository: erp/pmods/org.openbravo.retail.storeserver.synchronization
Changeset: 3f81060a571b5957586ce77702b27075277b325e
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed Mar 29 19:21:13 2017 +0200
URL: http://code.openbravo.com/erp/pmods/org.openbravo.retail.storeserver.synchronization/rev/3f81060a571b5957586ce77702b27075277b325e [^]

Fixes issue 35645: Prevents invoking a commitAndClose inside an eventhandler

---
M src/org/openbravo/retail/storeserver/synchronization/eventhandler/OrderEventHandler.java
---
(0095724)
mtaal   
2017-03-30 16:32   
Reviewed