Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calling Stored Procedures with Hibernate

 
Pauline Chao
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I've been stuck on this for a few days. I've tried my best searching for a solution, but couldn't find it

I have a SP that returns just one column. I've got it to work if it returns all columns of the record. But I can't seem to figure out how to do so for just one column.

What works
SP


Mapping File

SpectraReadings is mapping in another file to the table newspectro_testing.

What doesn't work
SP


Mapping File

This causes an "Errors in named queries: getAbsorptionByTimeRange" Exception.

I've also tried to map Absorption in a separate file as below:

Tried it with the table attribute, and without the table attribute.

Another thing I tried was to map it in the same file, as below:

But this gives a "The content of element type "class" must match "(meta*, ..." Exception.

Any advice is greatly appreciated!

Thank you,
Pauline
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately, because of 9i and below Oracle drivers not implementing the JDBC completely. Hibernate has some caveats/rules when calling stored procedures.

1) There can only be one out parameter
2) That parameter must be a refcursor
3) That parameter must be the first parameter.

There is more information on it in the Hibernate Documentation.

SOrry about that. Maybe in Hibernate 4.x they will be able to call more types of SPs.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic