• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

regarding query

 
MOHAMMAD SHOIAB
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a table with two fields invno and itemno, the invoic number gets repeated and so the item number also.
If i give a query in sql like - select itemno from invno where invno=1, i get all the items associated with the invoice number.

how do i achieve the same thing in hibernate
I have written a pojo for the table and also a mapping file and when I query the pojo I get a peculiar result
for example

invno | itemno
1 | 20
1 | 10
1 | 5

when i issue the query like
session.find("from inv where invno=1")
and if i iterate the result, then it will display
20
20
20

but i want
20
10
5

hope i am clear, please help

thanks in advance..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic