Forums Register Login

Select query not working properly

+Pie Number of slices to send: Send
Hi,

I am doing simple select query on a table, which has three separate records in database.
In the output, I see only one record, 3 times. It seems the rest of the objects are getting overwritten by the first object.

Code:

HBM file:


Please help!

[ August 11, 2008: Message edited by: Abhinav Sahai ]

[ August 11, 2008: Message edited by: Abhinav Sahai ]
[ August 11, 2008: Message edited by: Paul Sturrock ]
+Pie Number of slices to send: Send
So, you are querying for objects by primary key and expect three results? This sounds like imageID is not actually a primary key. Hibernate identifies object based on primary key (since that is the same logic the database uses). So if it finds one object with a specific id it assumes that is the only object of that type with that id.
+Pie Number of slices to send: Send
Your HBM file says that imageID is primary key.

So resultant ifnList doesn't contains more than one record.

In the output, I see only one record, 3 times.



Then how do you see one record 3 times ?
May be you want to achieve some thing else.
+Pie Number of slices to send: Send
Thanks a lot Paul and Kuldeep.
It was spot on.

ImageID was not the primary key, instead it was image_file_id

Thanks a lot again.
How do they get the deer to cross at the signs? Or to read this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 754 times.
Similar Threads
Exception when having different class and table name
How to specify relationship in mapping file
MappingException: Could not read mappings from resource
Classcast exception
Trouble in using joins in hibernate
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 03:54:36.