Meaningless Drivel is fun!*
The moose likes Object Relational Mapping and the fly likes No data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "No data " Watch "No data " New topic
Author

No data

Ananth Ram
Ranch Hand

Joined: Jan 18, 2001
Posts: 99
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
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
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
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No data
 
Similar Threads
Could not parse mapping document from resource PojoTestTable.hbm.xml
HIBERNATE hql.ast.QuerySyntaxException: (table name) is not mapped
JOIN syntax for HQL . Need help!
Foreign Key Constraint Fails
update