Example usage for org.hibernate.pretty MessageHelper collectionInfoString

List of usage examples for org.hibernate.pretty MessageHelper collectionInfoString

Introduction

In this page you can find the example usage for org.hibernate.pretty MessageHelper collectionInfoString.

Prototype

public static String collectionInfoString(CollectionPersister persister, Serializable id,
        SessionFactoryImplementor factory) 

Source Link

Document

Generate an info message string relating to a particular managed collection.

Usage

From source file:org.babyfish.hibernate.collection.spi.persistence.AbstractBasePersistence.java

License:Open Source License

@Override
public final boolean setCurrentSession(SessionImplementor session) throws HibernateException {
    if (session == this.getSession()) {
        return false;
    } else {/* w w w  .j av a 2s  . c om*/
        if (this.isConnectedToSession()) {
            CollectionEntry ce = session.getPersistenceContext()
                    .getCollectionEntry(this.getWrapperPersistentCollection());
            if (ce == null) {
                throw new HibernateException(
                        "Illegal attempt to associate a collection with two open sessions");
            } else {
                throw new HibernateException(
                        "Illegal attempt to associate a collection with two open sessions: "
                                + MessageHelper.collectionInfoString(ce.getLoadedPersister(), ce.getLoadedKey(),
                                        session.getFactory()));
            }
        } else {
            this.setSession(session);
            return true;
        }
    }
}