Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate | How to map class with nested component to a stored proc

 
Tausif Farooqi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm having a bit of trouble trying to map a class with multiple level of nested components to a stored procedure. It is easy to map a class with a single level of component (using a number "return-columns" within a "return-property"). But I cannot do that if my class has a component inside another component. I cannot change the nesting within the class because I am constrained by a schema. Can anyone please let me know how to map such a class? Given below is a class definition which is similar to one I have (assuming that my stored proc returns the exact number of columns required):



[ October 08, 2007: Message edited by: Tausif Farooqi ]
[ October 08, 2007: Message edited by: Tausif Farooqi ]
 
Tausif Farooqi
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have found a way to accomplish this mapping, but it doesn't look correct, but the funny thing is that it works!! This is how I defined my <sql-query> element within the same hbm.xml:



So even if I dont "specifically" define an element or return-property for the "Annuity" object it correctly maps the columns to the correct "Annuity" properties.

Can anyone tell me if this is a bug or a feature?
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That would be a bug and not one that I would rely on working.

here is the thing with Stored Procedures. They have caveats, and only work on one level of an object, because there are the following rules

1. Stored Procedure can have only one out parameter and it must be the first parameter
2. The out parameter can only be a reference cursor, it cannot be any custom datatype, or even nested from a few tables.

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