Hibernate version:2.1
i'm trying to model a 0-to-1 relations where transaction may have 0 or 1 feedback with:
Code:
<class name="ebay.vo.Transactions" table="Transactions">
<id name="id" column="id" type="java.lang.Integer">
<generator class="identity"/>
</id>
...
<one-to-one name="feedback" class="ebay.vo.Feedbacks" outer-join="true" constrained="false" property-ref="dbTransID"/>
</class>
<class name="ebay.vo.Feedbacks" table="Feedbacks">
<id name="id" column="id" type="java.lang.Integer">
<generator class="identity"/>
</id>
...
<property name="dbTransID" column="dbTransID" type="string"/>
</class>
(in fact, i wanna make Feedbacks.dbTransID a N-to-1 pointing back to Transactions, but i'd leave that in the mean time)
when i tried to load the transactions with :
Code:
List trans = session.createCriteria(Transactions.class).list();
it raised error:
Code:
DEBUG net.sf.hibernate.SQL - select feedbacks0_.id as id0_, feedbacks0_.buyerID as buyerID0_, feedbacks0_.itemID as itemID0_, feedbacks0_.transactionID as transact4_0_, feedbacks0_.dbTransID as dbTransID0_ from
Feedbacks feedbacks0_ where feedbacks0_.dbTransID=?
DEBUG net.sf.hibernate.impl.BatcherImpl - preparing statement
ERROR eBayBackOffice.transactionsMgt.action.GetTransactionsAction - java.lang.ClassCastException
java.lang.ClassCastException
at net.sf.hibernate.type.StringType.toString(StringType.java:47)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:46)
at net.sf.hibernate.type.NullableType.nullSafeSet(NullableType.java:35)
at net.sf.hibernate.loader.Loader.bindPositionalParameters(Loader.java:674)
...
it seems the program is trying to load feedback with null dbTransID.
i've tried every combinations of constrained and outer-join, but no luck.
any clues?