-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Urgent: Help needed stored procedures
PostPosted: Tue Mar 21, 2006 1:57 am 
Newbie

Joined: Wed Mar 08, 2006 9:43 pm
Posts: 5
Hibernate version: 3.1

I've asked several times but have not received any satisfactory answers.
I need to decide if I should use hibernate at all. Ideally it fits my future requirements, but for now I have a large number of stored procedures from which to map. I like the object identity concept of hibernate, have looked into Ibatis, which does not seem to offer that.

Here is what I need to do.
My domain objects look like this
clsA {
String aProp1;
String aProp2;
clsD d;
List listOfB;
List listOfC;
}
clsB { String bProp1; String bProp2; }
clsC { String cProp1; }
clsD { String dProp1; }

*** All properties of each of these classes are mapped to the database tables ***

My stored procedures return various combinations of properties of each of these classes.

Modifying these stored procs is not an option.

Is there any way to hydrate objects through a named query without using all the properties in the Class ? If not why not ? It seems like a reasonable thing to expect as long as the query knows the identify of the object that it will update.

I would like to see an example if possible.
Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 7:16 pm 
Expert
Expert

Joined: Thu Dec 23, 2004 9:08 pm
Posts: 2008
It is not directly possible. The reason is because hibernate is not designed from the point of view of offering access to data stored in databases: it is designed to allow you to persist java objects to databases. More top-down than bottom-up, as it were. That it offers simple access to result sets that don't completely map to your POJOs is a nice bonus, it isn't part hibernate's raison d'etre.

It is possible to use hibernate to access the result sets returned by your stored procedures, and then to write your own logic to put those result sets into java objects. You can then use those objects to save back to the DB, assuming that they have sensible values for all columns.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 4:11 am 
CGLIB Developer
CGLIB Developer

Joined: Thu Aug 28, 2003 1:44 pm
Posts: 1217
Location: Vilnius, Lithuania
Try " SELECT NULL as myProperty, .... FROM myProc() "


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.