List of usage examples for org.hibernate.persister.collection CollectionPersister readIndex
Object readIndex(ResultSet rs, String[] columnAliases, SharedSessionContractImplementor session)
throws HibernateException, SQLException;
From source file:org.babyfish.hibernate.collection.spi.persistence.ListBasePersistence.java
License:Open Source License
@SuppressWarnings("unchecked") @Override// w w w . j a v a 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 ww w.jav a2 s . c om 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; }