Hibernate version:2.1.7
Name and version of the database you are using: Oracle9i
Hi all,
I need to return a list of objects User, but only some
attributes of an object.
So, I did the following HQL:
Code:
select new User(u.name, u.jobFunction)
from User u
I´ve created the constructor for User:
Code:
// constructor 1
public User()
{
super();
}
// constructor 2
public User (String userName, String userJobFunction)
{
this.name = userName;
this.jobFunction = userJobFunction
}
but this HQL generate many queries and, after all the hibernate
uses the constructor 2.
I don´t need the other data, only the constructor.
How can I do to do not generate many queries in this case?
thanks!!!!