Example usage for org.hibernate.collection.internal AbstractPersistentCollection hasQueuedOperations

List of usage examples for org.hibernate.collection.internal AbstractPersistentCollection hasQueuedOperations

Introduction

In this page you can find the example usage for org.hibernate.collection.internal AbstractPersistentCollection hasQueuedOperations.

Prototype

@Override
    public final boolean hasQueuedOperations() 

Source Link

Usage

From source file:org.eclipse.emf.cdo.server.internal.hibernate.tuplizer.WrappedHibernateList.java

License:Open Source License

public int size() {
    if (cachedSize != -1) {
        return cachedSize;
    }/*  w  w  w  .j  a  va  2 s  .  co  m*/
    if (getDelegate() instanceof AbstractPersistentCollection) {
        final AbstractPersistentCollection collection = (AbstractPersistentCollection) getDelegate();
        if (collection.wasInitialized()) {
            cachedSize = -1;
            return getDelegate().size();
        }
        final SessionImplementor session = collection.getSession();
        CollectionEntry entry = session.getPersistenceContext().getCollectionEntry(collection);
        CollectionPersister persister = entry.getLoadedPersister();
        if (collection.hasQueuedOperations()) {
            session.flush();
        }
        cachedSize = persister.getSize(entry.getLoadedKey(), session);
        return cachedSize;
    }

    return getDelegate().size();
}