Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • 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..
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!