I don't know how to write a sql command with list of objects....? - TechRepublic
Question
August 31, 2010 at 11:31 PM
sara_h

I don’t know how to write a sql command with list of objects….?

by sara_h . Updated 15 years, 10 months ago

Hello
I am writing sql commands, with the use of hibernate, I want to retrieve objects named “LOAN”, that have 2 or more lists, I want the lists’ members, and performance is important for me.
I’ve already used this way…. At first I retrieve the LOAN objects with addEntity command, and then with iterating on lists, retrieve the Id of the members, and then retrieve each of the list members, with a sql command by sending its id as a parameter.
So a lot of commands are needed!
I wonder if it is better to retrieve all the list members with a uniqe command?
here is the code I’ve used:

((SqlQuery)session.createSqlQuery(sql)).addEntity(“LOAN”, Loan.class)

ps: My boss has forced me to use SQL instead of HQL with hibernate,
(because of HQL problems in performance!…) I don’t know if this is right? I would be appreciated, if somebody could help me with this, too.

This discussion is locked

All Comments