-->
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: Query filters not working if transaction manager is active
PostPosted: Thu Jan 08, 2009 2:26 pm 
Newbie

Joined: Fri Mar 02, 2007 4:32 am
Posts: 5
Location: Munich, Germany
Hi,

I use Hibernate 3.2.6ga in conjunction with Spring 2.5.6. I use the spring DAO support and it's transaction support. I use Annotation Configuration for hibernate.

I stepped over a problem with query filters and transactions. I had my app working for some time now but overlooked, that the @Transactional annotations weren't read until I put in <tx:annotation-driven transaction-manager="fundsaccessDomainTxManager" /> .

As mentioned I use query filters, see definition here:


Code:
@FilterDef(name = "plattform", parameters = @ParamDef(name = "plattformId", type = "long"))
@Filter(name = "plattform", condition = "plattform.id=:plattformId")


I activate that filter using


Code:
getSession().enableFilter("plattform").setParameter("plattformId",
            context.getPlattformId());



Without activated transaction the filter get's not applied at all, generated statement is

Code:
select [...] from dynamic.vermittler this_ left outer join dynamic.plattform plattform2_ on this_.plattform_fk=plattform2_.id left outer join dynamic.mandant mandant3_ on plattform2_.mandant_fk=mandant3_.id where this_.organisationseinheit_fk is null


After I activate the transactions, I get

Code:
select [...] from dynamic.vermittler this_ left outer join dynamic.plattform plattform2_ on this_.plattform_fk=plattform2_.id left outer join dynamic.mandant mandant3_ on plattform2_.mandant_fk=mandant3_.id where plattform.id=? and this_.organisationseinheit_fk is null


Difference is the included plattform.id=? in the second case.

So my questions:

Am I doing wrong? Is plattform not the to be expected name?
Why isn't the filter applied without a transaction?
How can I predict the column/table aliases?
Is this a bug?

Thank you in advance.

Regards,
Christian Kalkhoff[/code]


Top
 Profile  
 
 Post subject: Re: Query filters not working if transaction manager is acti
PostPosted: Sun Jan 11, 2009 2:19 pm 
Newbie

Joined: Fri Mar 02, 2007 4:32 am
Posts: 5
Location: Munich, Germany
Hi,

I´ve got it working. Problem was me since plattform.id is HQL not SQL as required.

There seems to be a bug anyway that (wrong?) so that filters do not get applied if there is no active transaction.

Regards.

Christian


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.