-->
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: Can we call a storedprocedure using Nhibernate
PostPosted: Fri Dec 02, 2005 6:14 am 
Newbie

Joined: Tue Nov 29, 2005 10:36 am
Posts: 7
Please let me know whether we can call a stored procedure on the database using NHibernate.
If there is a way for it, please explain it with an example.

I am involved in an Enterprise .NET application which uses remote Oracle database using NHibernate. If you NHibernate guys can help me find out more issues on NHibernate, it would be really great.

Thanks,
Suman Sajjana
India


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 11:34 am 
Senior
Senior

Joined: Wed Jun 15, 2005 4:17 am
Posts: 156
the short answer is: no. for the long answer please search the forum.

cheers,
Radu


Top
 Profile  
 
 Post subject:
PostPosted: Fri Dec 02, 2005 12:06 pm 
Beginner
Beginner

Joined: Wed Oct 05, 2005 5:35 am
Posts: 47
Location: France
As someone said (sorry, do not remember the author):
Quote:
1) For saving (inserting/updating/deleting): Because a class can define its own persistence strategy (by using its own IClassPersister implementation and using the attribute "persister" in the mapping file), it is possible to redirect the insert/update/delete operations to call stored procedures, instead of generating dynamic SQL.

In this case, the basic strategy would be:

- Inherit from the appropriate IClassPersister class (AbstractEntityPersister, EntitiyPersister or NormalizedEntityPersister)

- Override the corresponding Generate[Insert | Update | Delete]Strings method, to build a stored procedure call, instead of a DML SQL string.

- Override the corresponding action method(s) (Insert(), Delete(), Update()).

2) For loading data: I guess that if you are using a RDMBS that supports user-defined functions that return result sets, the best strategy is to:

- Move the logic from the stored procedure to a user-defined function
- Create a view that returns the result set from the user-defined function
- Use the columns of the view in the Xml mapping file
- Of course, to persist such class, you will need to define you own IClassPersister, as explained in the item 1.


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.