-->
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 Query By Example when i work with Composite Keys
PostPosted: Sat Jul 21, 2007 3:12 am 
Newbie

Joined: Sat Jul 21, 2007 3:04 am
Posts: 1
Hi,

I am tyring to use QBE.

My class structure is like the one below:

<hibernate-mapping>
<class name="com.rc.pojo.ExoticCurrency"
table="EXOTIC_CCY" schema="DB2ADMIN">
<composite-id name="exoticCurrencyId"
class="com.rc.pojo.ExoticCurrencyId">

<key-property name="countryCode" type="java.lang.String">
<column name="PROC_COUNTRY_CODE" />
</key-property>

<key-property name="exoticCurrency"
type="java.lang.String">
<column name="CCY_CODE" />
</key-property>

</composite-id>

</class>
</hibernate-mapping>

When i use QBE by se

ExoticCurrencyId exoticCurrencyId = new ExoticCurrencyId(originCountry,
currency);
ExoticCurrency exoticCurrency = new ExoticCurrency(exoticCurrencyId);


Example anExample = Example.create(exoticCurrency);

List results = session.createCriteria(ExoticCurrency.class).add(anExample).list();

I noticed that the Where clause is always returned as (1=1) instead of the values that i slotted in the Example argument.


Appreciate any assistance.

Thanks,
Manglu


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jul 24, 2007 1:04 pm 
Newbie

Joined: Tue Jul 24, 2007 1:00 pm
Posts: 2
QBE ignores values set in the composite-id.

It's in the documentation.

It ignores version, identifiers and associations.

You can use it for columns that are not part of the composite-id.


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.