-->
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.  [ 3 posts ] 
Author Message
 Post subject: how to write such hql of one-to-one mappinged with <set
PostPosted: Thu Mar 17, 2005 4:40 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
if use such mapping

<!-- bi-directional one-to-one association to PigeonholeRule -->
<one-to-one
name="pigeonholeRule"
class="com.fjky.xfile.core.orm.PigeonholeRule"
outer-join="auto"
/>


I can use hql as where XClass.PigeonholeRule.symbol<>'none'


if use such mapping, how to write hql????

<set name="setOfPigeonholeRule">
<key>
<column name="XTYPE_SYMBOL" length="16" not-null="false"
unique="true" />
</key>

<one-to-many
class="com.fjky.xfile.core.orm.PigeonholeRule" />
</set>

_________________
I am the creatxr of world.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 5:10 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
SQL:

select xource.* from xource
join xtype on xtype.symbol= xource.xtype_symbol
join pigeonhole_rule on pigeonhole_rule.xtype_symbol=xtype.symbol
join pigeonhole_type on pigeonhole_rule.pigeonhole_type_symbol=pigeonhole_type.symbol
where pigeonhole_type.symbol<>'none'
and xource.uid not in (select xfile.uid from xfile)


HQL:

StringBuffer hql = new StringBuffer("from Xource xource");
hql.append(" join xource.xtype xtype ");
hql.append(" join xtype.setOfPigeonholeRule pigeonholeRule ");
hql.append(" join pigeonholeRule.pigeonholeType pigeonholeType ");
hql.append(" where (xource.uid not in (select xfile.uid from Xfile xfile)) ");
hql.append(" and (pigeonholeType.symbol<>'none') ");


after join , I can't get any data. why?

what 's the problem?

_________________
I am the creatxr of world.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Mar 17, 2005 5:52 am 
Regular
Regular

Joined: Sat Apr 10, 2004 8:39 pm
Posts: 84
I want only return Xource objects

under conditions

hql.append(" where (xource.uid not in (select xfile.uid from Xfile xfile)) ");
hql.append(" and (pigeonholeType.symbol<>'none') ");

how to?

_________________
I am the creatxr of world.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.