| Author |
No data
|
Ananth Ram
Ranch Hand
Joined: Jan 18, 2001
Posts: 99
|
posted

0
|
Hi All,
I am a newbie to hibernate. I created a simple table as below.
TEST
Tid -- PK
ReportId
IndexId
I am able to insert data successfully. When I retrieve the same record. It does not return anything. Please look at the code below.
When I look at the List, no data is returned. Where am I wrong? Please advise on the same.
The hbm.xml file is as below
Thanks,
Ananth Ram
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
After you inserted your data did you commit the transaction? Are there any test objects that exists in the database with the report id you are using?
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Charan kumar sarvepalli
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
|
you have written SQL query (not HQL) so try to get data using session.createSQLQuery(sql);
|
-- Charan
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
Charan kumar sarvepalli wrote:you have written SQL query (not HQL) so try to get data using session.createSQLQuery(sql);
The above statement is valid in both languages.
|
 |
Ananth Ram
Ranch Hand
Joined: Jan 18, 2001
Posts: 99
|
posted

0
|
Yeah, the inserted data exists in the database.
Thanks,
Ananth Ram
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Then it should work. Any reason you are not logging any exception that may be thrown?
|
 |
Ananth Ram
Ranch Hand
Joined: Jan 18, 2001
Posts: 99
|
posted

0
|
Thanks all,
it works...
Thanks,
Ananth Ram
|
 |
Charan kumar sarvepalli
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
|
Ananth what makes solves your problem. can you post.
|
 |
Ananth Ram
Ranch Hand
Joined: Jan 18, 2001
Posts: 99
|
posted

0
|
Hi Charan,
First the createSQLQuery in stead of SQLQuery. Thanks for pointing out.
then the next step is casting the object[] from the result List.
Let me know if you need more info.
Thanks,
Ananth Ram
|
 |
Charan kumar sarvepalli
Ranch Hand
Joined: Dec 14, 2008
Posts: 40
|
|
|
just to know that solved your problem or you found any other solution.
|
 |
 |
|
|
subject: No data
|
|
|