I have a very simple suggestion but it is not a solution as I'm having a very similar problem: in the mapping document "class" and "type" are not the same. The former expects a (fully qualified) classname, where the latter expects a "basic value type". So rather than "java.lang.Date" I think you should have "date" (and you'll have to investigate separately whether that is java.lang.Date or java.sql.Date).
All that said, I'm still having basically the same problem that you are. My column is of hibernate type "timestamp" (java.sql.Timestamp). My map (generated by xdoclet) looks very similar to yours:
Code:
<list name="allEventMedia" lazy="false" cascade="all">
<key column="event_id"></key>
<index column="taken_timestamp" type="timestamp"></index>
<one-to-many class="com.spiralentertainment.model.Media"/>
</list>
I'm using Hibernate version 3.1.3 and a PostgreSQL 8.1.4 database.
Here is the relevant portion of the exception and call stack:
Code:
JDBCExceptionReporter.logExceptions(63) | could not initialize a collection: [com.spiralentertainment.model.Event.allEventMedia#1] [select alleventme0_.event_id as event9_1_, alleventme0_.media_id as media1_1
_, alleventme0_.taken_timestamp as taken10_1_, alleventme0_.media_id as media1_22_0_, alleventme0_.uploader_id as uploader3_22_0_, alleventme0_.mimetype as mimetype22_0_, alleventme0_.path as path22_0_, alleventme0_.suffix as suffix22_0_, alleventme0_.
title as title22_0_, alleventme0_.description as descript8_22_0_, alleventme0_.event_id as event9_22_0_, alleventme0_.taken_timestamp as taken10_22_0_, alleventme0_.type as type22_0_ from media alleventme0_ where alleventme0_.event_id=?]
org.postgresql.util.PSQLException: Bad value for type int : 2006-10-16 15:39:04.805
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.toInt(AbstractJdbc2ResultSet.java:2515)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:1994)
at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getInt(AbstractJdbc2ResultSet.java:2208)
at org.apache.commons.dbcp.DelegatingResultSet.getInt(DelegatingResultSet.java:236)
[b] at org.hibernate.type.IntegerType.get(IntegerType.java:28)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:113)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:102)
at org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:650)[/b]
at org.hibernate.collection.PersistentList.readFrom(PersistentList.java:358)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:994)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:635)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:689)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1919)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:36)