Hi,
I might miss something obvious here, but i cant seem to find any information regarding this in "hibernate in action" or in forums..
here goes..
I have the following 4 tables:
USER:
NAME
SUBSCRIBER:
FK_USER
ADDRESS
NOTIFIER:
FK_USER
ADDRESS
SUBSCRIPTION:
FK_SUBSCRIBER
FK_NOTIFIER
TYPE
I want to make _one_ query (with the Criteria API) for subscriptions.. the query should find all subscriptions that matches a certain subscription type and a specific name for both the subscriber and notifier.. all associations are modeled as many-to-one.. (subscription->subscriber, subscription->notifier, subscriber->user, notifier->user)
How to do this? I start out with:
Code:
Criteria subscriber = session.createCriteria(Subscription.class)add(Expression.like("type", someType).createCriteria("subscriber");
subscriber.createCriteria("user").add(Expression.like("name", someName);
but here im stuck.. how can i "navigate" back to Subscription to grab the notifier and make a similar criteria which is added to the total criteria?
Im using hibernate 2.1.3..
all help is appreciated!
Thanks,
-Kristoffer
[/u]