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 ]
posted 12 years ago
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.
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.