Example usage for org.hibernate.loader CollectionAliases getSuffixedElementAliases

List of usage examples for org.hibernate.loader CollectionAliases getSuffixedElementAliases

Introduction

In this page you can find the example usage for org.hibernate.loader CollectionAliases getSuffixedElementAliases.

Prototype

public String[] getSuffixedElementAliases();

Source Link

Document

Returns the suffixed result-set column-aliases for the columns making up the collection's elements.

Usage

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

License:Open Source License

@SuppressWarnings("unchecked")
@Override/*w  w  w .j  ava  2  s . c  o  m*/
public E readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
        throws HibernateException, SQLException {
    List<E> baseList = this.getBase();
    E element = (E) persister.readElement(rs, owner, descriptor.getSuffixedElementAliases(), this.getSession());
    int index = ((Integer) persister.readIndex(rs, descriptor.getSuffixedIndexAliases(), this.getSession()))
            .intValue();
    //pad with nulls from the current last element up to the new index
    for (int i = baseList.size(); i <= index; i++) {
        baseList.add(i, null);
    }
    baseList.set(index, element);
    return element;
}

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

License:Open Source License

@SuppressWarnings("unchecked")
@Override//from   w  w  w  .  j av a2s .c o  m
public V readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
        throws HibernateException, SQLException {
    V value = (V) persister.readElement(rs, owner, descriptor.getSuffixedElementAliases(), getSession());
    K key = (K) persister.readIndex(rs, descriptor.getSuffixedIndexAliases(), getSession());
    if (value != null) {
        this.getBase().put(key, value);
    }
    return value;
}

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

License:Open Source License

@SuppressWarnings("unchecked")
@Override/* www. j  av  a2  s  . c o m*/
public E readFrom(ResultSet rs, CollectionPersister persister, CollectionAliases descriptor, Object owner)
        throws HibernateException, SQLException {
    E element = (E) persister.readElement(rs, owner, descriptor.getSuffixedElementAliases(), this.getSession());
    if (element != null) {
        this.tempList.add(element);
    }
    return element;
}