Code example for SessionImplementor

Methods: getPersistenceContext

0
	} 
 
	public boolean addAll(int index, Collection c) {
		if ( c.size() > 0 ) {
			Iterator iter = c.iterator();
			while ( iter.hasNext() ) {
				add( index++, iter.next() );
			} 
			return true; 
		} 
		else { 
			return false; 
		} 
	} 
 
	public Object get(int index) {
		read(); 
		return values.get(index);
	} 
 
	public int indexOf(Object o) { 
		read(); 
		return values.indexOf(o);
	} 
 
	public int lastIndexOf(Object o) { 
		read(); 
		return values.lastIndexOf(o);
	} 
 
	public ListIterator listIterator() {
		read(); 
		return new ListIteratorProxy( values.listIterator() );
	} 
 
	public ListIterator listIterator(int index) {
		read(); 
		return new ListIteratorProxy( values.listIterator(index) );
	} 
 
	private void beforeRemove(int index) {
		Object removedId = identifiers.get( new Integer(index) );
		int last = values.size()-1;
		for ( int i=index; i<last; i++ ) {
			Object id = identifiers.get( new Integer(i+1) );
	        if ( id==null ) { 
				identifiers.remove( new Integer(i) );
	        } 
	        else { 
				identifiers.put( new Integer(i), id );
	        } 
		} 
		identifiers.put( new Integer(last), removedId );
	} 
 
	private void beforeAdd(int index) {
		for ( int i=index; i<values.size(); i++ ) {
			identifiers.put( new Integer(i+1), identifiers.get( new Integer(i) ) );
		} 
		identifiers.remove( new Integer(index) );
	} 
 
	public Object remove(int index) {
		write(); 
		beforeRemove(index);
		return values.remove(index);
	} 
 
	public Object set(int index, Object element) {
		write(); 
		return values.set(index, element);
	} 
 
	public List subList(int fromIndex, int toIndex) {
		read(); 
		return new ListProxy( values.subList(fromIndex, toIndex) );
	} 
 
	public boolean addAll(Collection c) {
		if ( c.size()> 0 ) {
			write(); 
			return values.addAll(c);
		} 
		else { 
			return false; 
		} 
	} 
 
	public void afterRowInsert( 
		CollectionPersister persister,
		Object entry, 
		int i)
		throws HibernateException {
		//TODO: if we are using identity columns, fetch the identifier 
	} 
 
}