-->
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: using session.load whit Composite-id
PostPosted: Mon Nov 17, 2003 3:02 am 
Newbie

Joined: Tue Oct 14, 2003 2:32 pm
Posts: 11
I have a group of legacy tables and used Middlegen to get the mappings
one of which is something like this

<class name="ejb.Purchase" table="PURCHASE">

<composite-id name="id" class="ejb.PurchasePK">
<key-property name="number" column="NUMBER" type="string"/>
<key-property name="branch" column="BRANCH" type="string" />
</composite-id>

<property name="other" type="string" column="OTHER"/>
</class>

I know the design sucks but I have

my problem is that when I try to use:

PurchasePK id=new PurchasePK("1","10");
Purchase p=(Purchase)session.load(Purchase.class,id) I get a row not found error

but if I submit something like this:
String query="from Purchase pur where pur.id.number=1
and pur.id=10"

List l=session.find(query);
p=(Purchase)l.get(o);

and I get the id from this object

PurchasePK id2=p.getId();

id2.equals(id) returns false.

I am using Oracle9i and the type fields from the composite are of type varchar2
also I am pretty sure that I had this working before I made some changes

I am stuck with it and I will appreciate some help
thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2003 3:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Looks OK to me.
Have you enabled the SQL output to see what it is trying to do?


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.