• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate not returning the required rows as it is from direct SQL

 
Naveen Chowdary
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate DAO:


Hibernate POJO:


hbm.xml:


Table:


With the above one it should get 1 row. But it returns only zero rows all the while.
and below is the sql generated by Hibernate

Hibernate: select appsrespon0_.ID as ID0_, appsrespon0_.NAME as NAME0_, appsrespon0_.MODULES as MODULES0_, appsrespon0_.SERVICES as SERVICES0_ from Apps_Responsibilities appsrespon0_
Size is:0


I am tired of looking into it again and again. PLease help me
 
Jana reddyMadam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why are you expecting one row return ? did you insert a row in table, because as per your code, i don't see anything which is really inserting a row in DB table.

just do this, run this query in database directly --> select count(*) from Apps_Responsibilities; --> if it gives Zero , then there is no data.

and then insert a row in db using below script;

insert into Apps_Responsibilities values (1,'Naveen','Module','Service');
commit;


And then run the Hibernate test program now it should give you the rows size as 1. all the best.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic