Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

 
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?
 
ranger
Posts: 17346
11
Mac IntelliJ IDE 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
 
    Bookmark Topic Watch Topic
  • New Topic