Hi, this is my first post in this forum. I'm new with hibernate. I'm using hibernate with jpa and annotations for mapping through classes. Now, I have two class: Order and User. A user can do one or many orders so there is a one-to-many connection from User to Order. This connection is represented by a private field in the Order class called user whose type is User. In other words, this user field is the foreign key.
Now, I need a select which allow to extract all the orders of a particular user. How can I do this? I tried a query like this: select new List(idOrder, articlename) from Order as od where od.user.idUser='1'
This query doesn't work... I think there is some problem in the reference to User entity through user field (od.user.idUser). How does the reference to entity field work?
Thanks to all people that will help me :-)
|