I have run into this problem as well. The toLoggableString method in CollectionType is the offender. It's not taking into account that CustomCollectionType throws an UnsupportedOperationException in getReturnedClass(). Did you ever get a reply concerning this? I didn't see anything in JIRA that seemed to pertain to this issue.
Code:
public String toLoggableString(Object value, SessionFactoryImplementor factory)
throws HibernateException {
if ( value == null ) return "null";
if ( Hibernate.isInitialized( value ) ) {
[b]if ( getReturnedClass().isInstance(value) ) {[/b] List list = new ArrayList();
Type elemType = getElementType( factory );
Iterator iter = getElementsIterator( value );
while ( iter.hasNext() ) {
list.add( elemType.toLoggableString( iter.next(), factory ) );
}
return list.toString();
}
else {
// for DOM4J "collections" only
return ( (Element) value ).asXML(); //TODO: it would be better if this was done at the higher level by Printer
}
}
else {
return "<uninitialized>";
}
}