List of usage examples for org.hibernate.engine.spi CollectionKey getRole
public String getRole()
From source file:org.jpos.ee.DB.java
License:Open Source License
@SuppressWarnings({ "unchecked" }) public void printStats() { if (getLog() != null) { LogEvent info = getLog().createInfo(); if (session != null) { info.addMessage("==== STATISTICS ===="); SessionStatistics statistics = session().getStatistics(); info.addMessage("==== ENTITIES ===="); Set<EntityKey> entityKeys = statistics.getEntityKeys(); for (EntityKey ek : entityKeys) { info.addMessage(String.format("[%s] %s", ek.getIdentifier(), ek.getEntityName())); }//from ww w.ja v a2 s . c o m info.addMessage("==== COLLECTIONS ===="); Set<CollectionKey> collectionKeys = statistics.getCollectionKeys(); for (CollectionKey ck : collectionKeys) { info.addMessage(String.format("[%s] %s", ck.getKey(), ck.getRole())); } info.addMessage("====================="); } else { info.addMessage("Session is not open"); } Logger.log(info); } }
From source file:org.jpos.transaction.DebugDB.java
License:Open Source License
@Override public int prepare(long id, Serializable context) { Context ctx = (Context) context; DB db = (DB) ctx.get(TxnConstants.DB); Session session = db.session();/*from w w w. j a v a 2 s . com*/ SessionStatistics statistics = session.getStatistics(); Set<EntityKey> entityKeys = statistics.getEntityKeys(); ctx.log(String.format("ENTITIES: (%d)", statistics.getEntityCount())); for (EntityKey ek : entityKeys) { Object obj = session.get(ek.getEntityName(), ek.getIdentifier()); LockMode lockMode = session.getCurrentLockMode(obj); ctx.log(String.format("[%s] %s %s", ek.getIdentifier(), ek.getEntityName(), lockMode)); } ctx.log("==== COLLECTIONS ===="); Set<CollectionKey> collectionKeys = statistics.getCollectionKeys(); for (CollectionKey ck : collectionKeys) { ctx.log(String.format("[%s] %s", ck.getKey(), ck.getRole())); } ctx.log("====================="); return PREPARED | READONLY | NO_JOIN; }