@@ -0,0 +1,2473 @@
+/*%0A * jPOS Project %5Bhttp://jpos.org%5D%0A * Copyright (C) 2000-2015 Alejandro P. Revilla%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU Affero General Public License as%0A * published by the Free Software Foundation, either version 3 of the%0A * License, or (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU Affero General Public License for more details.%0A *%0A * You should have received a copy of the GNU Affero General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A */%0A%0Apackage org.jpos.transaction;%0A%0Aimport org.hibernate.LockMode;%0Aimport org.hibernate.Session;%0Aimport org.hibernate.engine.spi.CollectionKey;%0Aimport org.hibernate.engine.spi.EntityKey;%0Aimport org.hibernate.stat.SessionStatistics;%0Aimport org.jpos.ee.DB;%0A%0Aimport java.io.Serializable;%0Aimport java.util.Set;%0A%0A@SuppressWarnings(%22unchecked unused%22)%0Apublic class DebugDB implements AbortParticipant %7B%0A    @Override%0A    public int prepare(long id, Serializable context) %7B%0A        Context ctx = (Context) context;%0A        DB db = (DB) ctx.get(TxnConstants.DB);%0A%0A        Session session = db.session();%0A        SessionStatistics statistics = session.getStatistics();%0A        Set%3CEntityKey%3E entityKeys = statistics.getEntityKeys();%0A        ctx.log (String.format (%22ENTITIES:  (%25d)%22, statistics.getEntityCount()));%0A        for (EntityKey ek : entityKeys) %7B%0A            Object obj = session.get(ek.getEntityName(), ek.getIdentifier());%0A            LockMode lockMode = session.getCurrentLockMode(obj);%0A            ctx.log(String.format(%22%5B%25s%5D %25s %25s%22, ek.getIdentifier(), ek.getEntityName(), lockMode));%0A        %7D%0A        ctx.log (%22==== COLLECTIONS ====%22);%0A        Set%3CCollectionKey%3E collectionKeys = statistics.getCollectionKeys();%0A        for (CollectionKey ck : collectionKeys) %7B%0A            ctx.log(String.format(%22%5B%25s%5D %25s%22, ck.getKey(), ck.getRole()));%0A        %7D%0A%0A        ctx.log(%22=====================%22);%0A        return PREPARED %7C READONLY %7C NO_JOIN;%0A    %7D%0A%0A    @Override%0A    public int prepareForAbort(long id, Serializable context) %7B%0A        return prepare(id, context);%0A    %7D%0A%0A    @Override%0A    public void commit(long id, Serializable context) %7B %7D%0A%0A    @Override%0A    public void abort(long id, Serializable context) %7B %7D%0A%7D%0A

Add handy DebugDB participant