Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Problem with Sybase stored proc in hibernate

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The procedure works fines outside hibernate...the column(wbUserGrpId) is NOT unique within resultset.
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made the changes to the proc and workign fine....thanks
 
A feeble attempt to tell you about our stuff that makes us money
Garden Master Course kickstarter
https://coderanch.com/t/754577/Garden-Master-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic