-->
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: problem with not-found="ignore"
PostPosted: Fri May 20, 2005 10:13 am 
Newbie

Joined: Fri May 20, 2005 9:48 am
Posts: 2
Hibernate version: 3.0.3

Mapping documents:
<hibernate-mapping>
<class name="LoginVO" table="LOGIN">
...
<many-to-one name="record1" not-found="ignore" class="MyClass">
<column name="COL1"/>
</many-to-one>
<many-to-one name="record2" not-found="ignore" class="MyClass">
<column name="COL2"/>
</many-to-one>
...
</hibernate-mapping>

Name and version of the database:
Oracle 9i

We have a Hibernate Query which looks like this:
SELECT count(logT.*) FROM LoginVO logT WHERE
logT.record1 is not null AND logT.record1.name = 'foo';

And this query works fine ( returns 1 ).

But if we extend this query to this:
SELECT count(logT.*) FROM LoginVO logT WHERE
(logT.record1 is not null AND logT.record1.name = 'foo')
OR
(logT.record2 is not null AND logT.record2.name = 'foo')


When we run this query and record2 is null it returns 0 (without any errors), if it's not null it returns 1.

Is this a known bug of not-found="ignore" or is it deliberate and we are just missing something?

Thanks for any insight in this matter

Darek


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 11:09 am 
Newbie

Joined: Thu Feb 17, 2005 3:01 pm
Posts: 9
Use fetch="join" in the many-to-one element.

We had the same problem, this resolved it for us


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 12:05 pm 
Newbie

Joined: Fri May 20, 2005 9:48 am
Posts: 2
Thanks,
It seems that now it works fine.

Thanks again for fast reply :)


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.