Hello all,
This is my first post so thank you for reading this.
Code:
I have a query that i would like to optimize a bit:
Criteria crit = session.createCriteria(Etablishment.class);
crit.setFetchMode("status", FetchMode.JOIN)
.setFetchMode("Company", FetchMode.JOIN)
.setFetchMode("diffusions", FetchMode.JOIN);
etaList.addAll((crit.add(Restrictions.in("id",ids)).list()));
First of all, what do you think is best to do :
- Doing a IN restriction clause for something like 10 IDs)
- Fetching the elements for about ten times.
Is there a time when one method is better than the other?
-------------
i am fetching quite a lot of data for only a few data which i need for this batch, is there a way to optimize that?
i have the following object relations:
Etablishment --> Company --> HQ (an Etablishment) --> status (object)
Etablishment --> Company --> Code (String)
Etablishment --> name (String)
Etablishment --> diffusions(List)
So, i need only these objects to be load and not the rest.
Is it possible?
Thank you for your time.