User - contains user information
application - contains applications information
user2application - a bridge table between user and application. Composed of primary key or user, and primary key of application
Retreive all users by application ID.
I created this criteria, but not efficient. Produces a select statement for every user.
Is there any other efficient way?
Paul Sturrock wrote:Try changing the fetch mode.
The fetch mode in the .hbm file is set to join
I added this line:
crit = getHbnSession().createCriteria(User2Application.class, "u2a");
crit = crit.setProjection(Property.forName("user"));
crit = crit.createCriteria("user", "u");
But, it didn't do anything different.
Any other ideas?