Beginner |
 |
Joined: Thu Jan 06, 2005 6:21 pm Posts: 23
|
Hibernate version:3.0
I have the following HQL query:
select parameter.data
from Repository repository
inner join repository.events as event
inner join event.parameter as parameter
where repository.id = :id and parameter.data is not null
that generate the following sql:
select parameter.data as parameter
from RepositoryTable repository
inner join RepositoryEventTable repositoryEvent
on repository.id=repositoryEvent.repositoryId
inner join EventTable event
on repositoryEvent.eventId=event.id
inner join ParameterTable parameter
on event.parameter=parameter.id
where repository.id='1' and parameter.data is not null
I'd like to move the condition in the WHERE clause in the FROM clause has it improves the performance of the query:
select parameter.data as parameter
from RepositoryTable repository
inner join RepositoryEventTable repositoryEvent
on repository.id=repositoryEvent.repositoryId and repository.id='1'
inner join EventTable event
on repositoryEvent.eventId=event.id
inner join ParameterTable parameter on event.parameter=parameter.id and parameter.data is not null
I didn't find a way to write a HQL query that will generate such a sql statement.
Is it possible? If yes, how do I do that.
Thanks,
Richard
|
|