-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Modelling zero-to-one
PostPosted: Mon Aug 30, 2004 3:08 am 
Newbie

Joined: Mon Jul 12, 2004 2:52 am
Posts: 17
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?


Top
 Profile  
 
 Post subject: sorry guys
PostPosted: Mon Aug 30, 2004 3:30 am 
Newbie

Joined: Mon Jul 12, 2004 2:52 am
Posts: 17
i made the class of dbTransID wrong, it's ok now


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.