Hi:
I have one-to-many association between agency and agent entities, agency has a collection of agents.
I am trying to write an hql that would return me only active agencies, each having a collection of only active agents:
Code:
Query q = session.createQuery("from AgencyImpl agency left outer join fetch agency.agents agent where agency.deleted='N' and agent.deleted='N'");
If an agency is active, it should be returned regardless whether it has qualifying agent or not. When run, the above hql returns only those agencies, whose agents meet the criteria "agent.deleted='N'", ignoring outer join clause when agents are missing or when they are inactive.
Please, help.
Thank you.