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.  [ 1 post ] 
Author Message
 Post subject: How can you minimize database call with nhibernate?
PostPosted: Mon Apr 07, 2008 2:52 am 
Newbie

Joined: Mon Apr 07, 2008 2:31 am
Posts: 1
Dear all,

Hi there. I am too used with stored procedures. I wonder how can you achieve this in NHibernate since I am picking this technology. As you can see, below is my stored procedure:

// pseudocode
sproc usp_InsertNewRecord

Begin

-- IF (Check whether any records exists)
------ IF NO RECORD EXISTS
--------- INSERT ...
--- ELSE
------ RETURN SOME ERROR VALUE
End

As you can see my .NET calls this stored procedure 1 time (1 database call) and within it, i could have to process all these.

If I have to use nhibernate 2.0 alpha and do my checking within C#, i will probably call database twice

a. Validates whether any record exists
b. If Not Exists, then insert

How can i make nhibernate calls Database once, just like how i manage my stored procedures?

Or is there a better way to handle this with nhibernate best practices?

Any help? Thanks.


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

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.