on 2021 Apr 07 6:19 PM
hello all,
I am very often had this error: "Multiple open receipts for current user!", when I get the receipt on screen like this:
cdbSession = CDBSessionFactory.instance.createSession();
receiptManager = ServiceFactory.INSTANCE.getOrCreateServiceInstance(ReceiptPosService.class, cdbSession);
receipt = receiptManager.findOrCreate(UserRegistry.INSTANCE.getCurrentUser(), null, true);
I can't identify what causes it, and I'm closing the CDBSession that I create.
if(!cdbSession.isClosed())
cdbSession.closeDBSession();
I am getting the receipt object in the method:
@PluginAt(pluginClass = OrderPosService.class, method = "finishOrder", where = POSITION.BEFORE)
Anyone knows how to solve this?
Request clarification before answering.
Hi josehrmatos,
dont open another db session when you're hooked in a PosService. Permanently! Don't do it.
The posService is the object, you will get as "proxy". This service should have a method called getDbSession().
public void onFinishOrder(Object proxy, Object[] args, Object ret, StackTraceElement caller) {
OrderPosService posService = (OrderPosService) proxy;
CDBSession session = posService.getDbSession();
...
}When you open another db session some strange side effects will occur!
Regards
Robert
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.