Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp
Hibernate version:
3.0
Mapping documents:
<hibernate-mapping package="com.wiag.hdb.model">
<class name="LieferPunktGruppeInfo" table="A10T_LFPGRP_INF">
<composite-id name="id" class="LieferPunktGruppeInfoKey">
<key-property name="lieferPunktGruppeID" column="LFPGRP_LFPGRP" type="java.lang.Long"/>
<key-property name="vertragID" column="LFPGRP_ZO_ID" type="java.lang.Long"/>
<key-property name="typ" column="TYP" type="java.lang.Integer"/>
<key-property name="von" column="VON" type="java.util.Date"/>
<key-property name="za" column="ZA" type="java.lang.Integer"/>
</composite-id>
<timestamp name="aendZm" column="AEND_ZM"/>
<property name="bis" column="BIS" type="java.util.Date" />
<property name="wert" column="WERT" type="java.lang.Long" not-null="true" />
<property name="wertEh" column="WERT_EH" type="java.lang.Long" not-null="true" />
<property name="aendId" column="AEND_ID" type="java.lang.Long" />
</class>
</hibernate-mapping>
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
java.lang.UnsupportedOperationException: cannot perform lookups on timestamps
at org.hibernate.type.TimestampType.getHashCode(TimestampType.java:99)
at org.hibernate.type.AbstractType.getHashCode(AbstractType.java:119)
at org.hibernate.type.ComponentType.getHashCode(ComponentType.java:162)
at org.hibernate.engine.EntityKey.getHashCode(EntityKey.java:68)
at org.hibernate.engine.EntityKey.<init>(EntityKey.java:41)
at org.hibernate.loader.Loader.getKeyFromResultSet(Loader.java:664)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:277)
at org.hibernate.loader.Loader.doQuery(Loader.java:384)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:203)
at org.hibernate.loader.Loader.loadCollection(Loader.java:1344)
at org.hibernate.loader.collection.OneToManyLoader.initialize(OneToManyLoader.java:106)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:484)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:60)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1346)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:170)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:47)
at org.hibernate.collection.PersistentSet.iterator(PersistentSet.java:133)
at test.com.wiag.hdb.dao.TestLieferPunktGruppeDAO.testGetLieferPunktVertragByLieferPunktGruppeKey(TestLieferPunktGruppeDAO.java:80)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
A legacy database used composite business key with a timestamp column. It seems that such a timestamp column as a key column is not supported any more in Hibernate 3.x. Ist there any workaround for this problemm without changing the database schema?