/** * Get an iterator over the element set of the collection, which may not yet be wrapped * * @param collection The collection to be iterated * @param session The session from which the request is originating. * @return The iterator. */ public Iterator getElementsIterator(Object collection, SharedSessionContractImplementor session) { return getElementsIterator( collection ); }
/** * Given a collection, get an iterator of all its children, loading them * from the database if necessary. * * @param session The session within which the cascade is occuring. * @param collectionType The mapping type of the collection. * @param collection The collection instance. * * @return The children iterator. */ public static Iterator getAllElementsIterator( EventSource session, CollectionType collectionType, Object collection) { return collectionType.getElementsIterator( collection, session ); }
protected String renderLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException { if ( !Hibernate.isInitialized( value ) ) { return "<uninitialized>"; } final List<String> list = new ArrayList<>(); Type elemType = getElementType( factory ); Iterator itr = getElementsIterator( value ); while ( itr.hasNext() ) { Object element = itr.next(); if ( element == LazyPropertyInitializer.UNFETCHED_PROPERTY || !Hibernate.isInitialized( element ) ) { list.add( "<uninitialized>" ); } else { list.add( elemType.toLoggableString( element, factory ) ); } } return list.toString(); }
/** * Iterate just the elements of the collection that are already there. Don't load * any new elements from the database. */ public static Iterator getLoadedElementsIterator( SharedSessionContractImplementor session, CollectionType collectionType, Object collection) { if ( collectionIsInitialized( collection ) ) { // handles arrays and newly instantiated collections return collectionType.getElementsIterator( collection, session ); } else { // does not handle arrays (thats ok, cos they can't be lazy) // or newly instantiated collections, so we can do the cast return ((PersistentCollection) collection).queuedAdditionIterator(); } }
public boolean contains(Object collection, Object childObject, SharedSessionContractImplementor session) { // we do not have to worry about queued additions to uninitialized // collections, since they can only occur for inverse collections! Iterator elems = getElementsIterator( collection, session ); while ( elems.hasNext() ) { Object element = elems.next(); // worrying about proxies is perhaps a little bit of overkill here... if ( element instanceof HibernateProxy ) { LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer(); if ( !li.isUninitialized() ) { element = li.getImplementation(); } } if ( element == childObject ) { return true; } } return false; }
/** * Get an iterator over the element set of the collection, which may not yet be wrapped * * @param collection The collection to be iterated * @param session The session from which the request is originating. * @return The iterator. */ public Iterator getElementsIterator(Object collection, SessionImplementor session) { return getElementsIterator(collection); }
/** * Iterate all the collection elements, loading them from the database if necessary. */ private static Iterator getAllElementsIterator(SessionImplementor session, CollectionType collectionType, Object collection) { return collectionType.getElementsIterator(collection, session); }
/** * Get an iterator over the element set of the collection, which may not yet be wrapped * * @param collection The collection to be iterated * @param session The session from which the request is originating. * @return The iterator. */ public Iterator getElementsIterator(Object collection, SessionImplementor session) { return getElementsIterator(collection); }
/** * Given a collection, get an iterator of all its children, loading them * from the database if necessary. * * @param session The session within which the cascade is occuring. * @param collectionType The mapping type of the collection. * @param collection The collection instance. * @return The children iterator. */ private static Iterator getAllElementsIterator( EventSource session, CollectionType collectionType, Object collection) { return collectionType.getElementsIterator( collection, session ); }
/** * Given a collection, get an iterator of all its children, loading them * from the database if necessary. * * @param session The session within which the cascade is occuring. * @param collectionType The mapping type of the collection. * @param collection The collection instance. * @return The children iterator. */ private static Iterator getAllElementsIterator( EventSource session, CollectionType collectionType, Object collection) { return collectionType.getElementsIterator( collection, session ); }
protected String renderLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException { final List<String> list = new ArrayList<String>(); Type elemType = getElementType( factory ); Iterator itr = getElementsIterator( value ); while ( itr.hasNext() ) { list.add( elemType.toLoggableString( itr.next(), factory ) ); } return list.toString(); }
protected String renderLoggableString(Object value, SessionFactoryImplementor factory) throws HibernateException { final List<String> list = new ArrayList<String>(); Type elemType = getElementType( factory ); Iterator itr = getElementsIterator( value ); while ( itr.hasNext() ) { list.add( elemType.toLoggableString( itr.next(), factory ) ); } return list.toString(); }
public boolean contains(Object collection, Object childObject, SessionImplementor session) { // we do not have to worry about queued additions to uninitialized // collections, since they can only occur for inverse collections! Iterator elems = getElementsIterator( collection, session ); while ( elems.hasNext() ) { Object element = elems.next(); // worrying about proxies is perhaps a little bit of overkill here... if ( element instanceof HibernateProxy ) { LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer(); if ( !li.isUninitialized() ) element = li.getImplementation(); } if ( element == childObject ) return true; } return false; }
public boolean contains(Object collection, Object childObject, CollectionPersister persister, SessionImplementor session) { // we do not have to worry about queued additions to uninitialized // collections, since they can only occur for inverse collections! Iterator elems = getElementsIterator( collection, session ); while ( elems.hasNext() ) { Object element = elems.next(); // worrying about proxies is perhaps a little bit of overkill here... if ( element instanceof HibernateProxy ) { LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer(); if ( !li.isUninitialized() ) element = li.getImplementation(); } if ( element == childObject ) return true; } return false; }
/** * Iterate just the elements of the collection that are already there. Don't load * any new elements from the database. */ public static Iterator getLoadedElementsIterator(SessionImplementor session, CollectionType collectionType, Object collection) { if ( collectionIsInitialized(collection) ) { // handles arrays and newly instantiated collections return collectionType.getElementsIterator(collection, session); } else { // does not handle arrays (thats ok, cos they can't be lazy) // or newly instantiated collections, so we can do the cast return ( (PersistentCollection) collection ).queuedAdditionIterator(); } }
public boolean contains(Object collection, Object childObject, SessionImplementor session) { // we do not have to worry about queued additions to uninitialized // collections, since they can only occur for inverse collections! Iterator elems = getElementsIterator( collection, session ); while ( elems.hasNext() ) { Object element = elems.next(); // worrying about proxies is perhaps a little bit of overkill here... if ( element instanceof HibernateProxy ) { LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer(); if ( !li.isUninitialized() ) element = li.getImplementation(); } if ( element == childObject ) return true; } return false; }
public boolean contains(Object collection, Object childObject, SessionImplementor session) { // we do not have to worry about queued additions to uninitialized // collections, since they can only occur for inverse collections! Iterator elems = getElementsIterator( collection, session ); while ( elems.hasNext() ) { Object element = elems.next(); // worrying about proxies is perhaps a little bit of overkill here... if ( element instanceof HibernateProxy ) { LazyInitializer li = ( (HibernateProxy) element ).getHibernateLazyInitializer(); if ( !li.isUninitialized() ) element = li.getImplementation(); } if ( element == childObject ) return true; } return false; }
/** * Iterate just the elements of the collection that are already there. Don't load * any new elements from the database. */ public static Iterator getLoadedElementsIterator(SessionImplementor session, CollectionType collectionType, Object collection) { if ( collectionIsInitialized(collection) ) { // handles arrays and newly instantiated collections return collectionType.getElementsIterator(collection, session); } else { // does not handle arrays (thats ok, cos they can't be lazy) // or newly instantiated collections, so we can do the cast return ( (PersistentCollection) collection ).queuedAdditionIterator(); } }
/** * Iterate just the elements of the collection that are already there. Don't load * any new elements from the database. */ public static Iterator getLoadedElementsIterator(SessionImplementor session, CollectionType collectionType, Object collection) { if ( collectionIsInitialized(collection) ) { // handles arrays and newly instantiated collections return collectionType.getElementsIterator(collection, session); } else { // does not handle arrays (thats ok, cos they can't be lazy) // or newly instantiated collections, so we can do the cast return ( (PersistentCollection) collection ).queuedAdditionIterator(); } }
/** * Get an iterator over the element set of the collection, which may not yet be wrapped */ public Iterator getElementsIterator(Object collection, SessionImplementor session) { if ( session.getEntityMode()==EntityMode.DOM4J ) { final SessionFactoryImplementor factory = session.getFactory(); final CollectionPersister persister = factory.getCollectionPersister( getRole() ); final Type elementType = persister.getElementType(); List elements = ( (Element) collection ).elements( persister.getElementNodeName() ); ArrayList results = new ArrayList(); for ( int i=0; i<elements.size(); i++ ) { Element value = (Element) elements.get(i); results.add( elementType.fromXMLNode( value, factory ) ); } return results.iterator(); } else { return getElementsIterator(collection); } }