Hibernate version: 2.1.7
Name and version of the database you are using: Oracle9i
Hi all again,
I Have a User and yours documents, like this:
Code:
public class User implements Serializable
{
/** idUser attribute */
private Long idUser;
/** name attribute */
private String name;
/** login attribute */
private String login;
/** password attribute */
private String password;
/** email attribute */
private String email;
/** jobFunction attribute */
private String jobFunction;
/** list of userDocuments */
private List userDocuments;
// default constructor
public User()
{
super();
}
// constructor 2
public User(Long idUser, List userDocuments)
{
this.idUser = idUser;
this.userDocuments = userDocuments;
}
.
.
.
}
public class UserDocument implements Serializable
{
/** idDocument attribute */
private Long idDocument;
/** nbDocument attribute */
private String nbDocument;
/** user attribute */
private User user;
.
.
.
}
I need only to load the idUser and list of documents. So I´ve created
a constructor on the User class. I try to do a hql like this:
Code:
select new User(idUser, u.userDocuments)
from User u
left join u.userDocuments uDoc
but an error occurs, where is expected "elements".
when I try to use the "elements":
Code:
select new User(idUser, elements(u.userDocuments))
from User u
left join u.userDocuments uDoc
the above hql causes other error, because the elements(u.userDocuments) returns
only one userDocument.
Is there a way to return the list of objetcs User with idUser and yours list of documents
by using the constructor like above, with a attribute and a collection to load?
thanks!!!