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]