-->
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: Change in behaviour of where attribute since 3.0
PostPosted: Wed Feb 08, 2006 9:02 am 
Newbie

Joined: Wed Feb 08, 2006 8:29 am
Posts: 10
Hibernate version: 3.1

Hello,

We have a setup that used to work fine in Hibernate 3.0, but the behaviour appears to have changed in 3.1 onward, and our code no longer works.

Its a class that has a few bags that each have a where= attribute, to apply a filter on the selection.

Since 3.1, hibernate is modifying this sql to insert (+) after each field, when I execute session merge, to save it. It reterieves the object and bags/sets etc using sql with a single outer join first. In 3.0, it retrieved the object, and its collections each using separate queries, so no outer join.

Now, my where attributes have sql that has an OR in it. And you can't do this in Oracle, you get a 'ORA-01719: outer join operator (+) not allowed in operand of OR or IN' sql error.

For example say Person and Address. Then you might have the following inside your Person hbm, to enable access to a Persons addresses:

<bag name="addresses" where="(isInvalid=0 or isInvalid is null)">
<key column="ID"/>
<one-to-many class="Person"/>
</bag>

Hibernate wrotes the following sql:
select ....
from PERSON person0_, ADDRESS address1_
where person0_.ADDRESSID=address1_.ID and
(address1_.ISINVALID(+)=0 or address1_.ISINVALID(+) is null)

Incidentally, if you try to use a function in the above, such as NVL, you get a Missing Expression SQL error. So it appears the sql inside the where attribute has become more restricted.

Does anyone know anything about this? Is doing this type of thing no longer valid? Am I doing something wrong? Any help would be greatly appreciated.

Thanks in advance.


Top
 Profile  
 
 Post subject: Change in behaviour of where attribute since 3.0
PostPosted: Wed Feb 08, 2006 9:50 am 
Newbie

Joined: Wed Feb 08, 2006 8:29 am
Posts: 10
Hi again,

I managed to find a workaround, by setting:
hibernate.max_fetch_depth=0
This causes it to emulate the same behaviour as 3.0, i.e. it gets the collections of objs in separate queries rather than getting an obj and collections in the one query with outer joins.

Has an outer join fetching been enabled by default in 3.1? I thought this only applied where fetch="join", I don't use that. Incidentally, I tried setting fetch="select" and fetch="subselect" to no avail.

There still appears to be issues with using the where= attribute and using outer joins. Any thoughts, or am I not using it properly?

Thanks


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.