• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Sybase stored proc in hibernate

 
pramodh somashekara
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a problem in accessing resultset from Sybase stored procedure. It is displaying ONLY the first row of the resultset.

The mapping file is



The stored proc contains only the SELECT statement on three tables.

The hibernate tells correctly the size of the resultset when I use size() on the result list. But when I try to display, it displays only the FIRST ROW SO MANY NUMBER OF TIMES.

Let us say, the query gives 3 rows, then hibernate gives size as 3 but displays FIRST ROW, THREE TIMES.

Can anybody tell about this problem?

Pramodh

[ Edited to use code tags - Paul Sturrock ]
[ December 15, 2006: Message edited by: Paul Sturrock ]
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you tell us more about the procedure and the data it returns? Does the procedure work OK ouside of Hibernate? Is the key that identifies each row in the results set (wbUserGrpId) unique within the result set?
 
pramodh somashekara
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The procedure works fines outside hibernate...the column(wbUserGrpId) is NOT unique within resultset.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is your problem. Hibernate maps relational data. Relational data by definition must have a unique identifier: any entity without a primary key cannot be uniquely indentified and so cannot form part of a relationship. So every mapped object must have a primary key. Can you cahnge your procedure so it uniquely identifies each row, possibly by returning a surrogate key with each result?
[ December 15, 2006: Message edited by: Paul Sturrock ]
 
pramodh somashekara
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made the changes to the proc and workign fine....thanks
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic