-->
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: Bug in createCriteria or createAlias?
PostPosted: Wed Jul 07, 2004 3:08 am 
Newbie

Joined: Sat Nov 01, 2003 12:35 pm
Posts: 11
Hi,
I use criteria api createCriteria or createAlias to make association between classes. I find there is bug in the formed sql which does not have the referenced class in the from clause when the reference is part of composite-id (that is, it is key-many-to-one). If the reference is NOT part of composite-id (that is, it is man-to-one), the from clause in sql is correct. The following is my setting and error: (the alias 'rsltn' is missing in the from clause)

<class name="com.tsmc.pdmcp.testtime.table.CpTestTimeTable" table="CP_TEST_TIME">

<composite-id>
<key-property name="frequencyType" column="freq_type"/>
<key-property name="testTimeType" column="test_time_type"/>
<key-property name="createDate" column="create_dt" type="timestamp"/>
<key-many-to-one name="rslTnTable" class="com.tsmc.pdmcp.testtime.table.CpRslTnTable" column="rsltn_id"/>
</composite-id>

<property name="testTime">
<column name="test_time" sql-type="number(16,4)"/>
</property>

<property name="waferQuantity">
<column name="wafer_qty" sql-type="number(10)"/>
</property>

</class>

the incorret sql is as follows:

select this.freq_type as freq_type0_, this.test_time_type as test_tim2_0_, this.create_dt as create_dt0_, this.rsltn_id as rsltn_id0_, this.test_time as test_time0_, this.wafer_qty as wafer_qty0_ from CP_TEST_TIME this where this.test_time_type=? and this.freq_type=? and this.create_dt between ? and ? and rsltn.part_id like ? and rsltn.prod_body=? and rsltn.test_site_cd=? and rsltn.eqp_type=? and rsltn.stage_id like ? and rsltn.test_prog_name like ? and rsltn.dut_cnt like ?


Where is the 'rsltn'?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 07, 2004 3:28 pm 
Expert
Expert

Joined: Sat Jan 17, 2004 2:57 pm
Posts: 329
Location: In the basement in my underwear
Rice, is your problem the same as mine?

http://forum.hibernate.org/viewtopic.php?t=932243

You don't have the code that adds the criteria but I am assuming you are attempting to filter your query by some property off of the CpRslTnTable in your composite primary key?

If you could provide the code where you're trying to set up the criteria?

If it is the same problem as I encountered (I don't have a solution yet btw) I had traced some of the source code and it looked like it wasn't creating the appropriate alias since the key many-to-one wasn't listed as an association.


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.