2010
04.11








I am currently doing a project utilizing NHibernate to connect to a legacy Oracle DB. Everything was nice and easy until I hit this problem. I need to retrieve a particular information, but to do this I must connect a number of tables. This means I need to create more persistent classes, more mapping files, which is sucks because I can actually just execute a stored function and get what I need.
Nhibernate

So after scratching my head for quite sometimes, I found out that the solution was quite simple.

Using sessFact As ISessionFactory = CreateSessionFactory()
   Using sess As ISession = sessFact.OpenSession()
      Using transact As ITransaction = sess.BeginTransaction()
         '....
         Dim con As IDbConnection = sess.Connection
         Dim cmd As IDbCommand = con.CreateCommand()
         sess.Transaction.Enlist(cmd)
         cmd.CommandText = "select MyPackageName.MyFunction(" & myFunctionParam & ") from dual"
         dim objResult as Objetc = cmd.ExecuteScalar()
         '.....
      End Using
   End Using
End Using

I know this is not the right way, but I need to make compromise considering that this is a legacy database.

Share and Enjoy

  • Facebook
  • Twitter
  • Google
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

 

Possibly Related Posts

 

Incoming Search Term

nhibernate oracle function (12), nhibernate logo (6), nhibernate call oracle function (2), nhibernate call function (2), how to use nhibernate to call function oracle (2), nhibernate charp stored function oracle (1), nhibernate how execute oracle stored function (1), nhibernate oracle (1), nhibernate oracle call function (1), nhibernate oracle call package function (1), nhibernate oracle functions (1), nhibernate oracle sysdate function (1), nibernate oracle table function select * from table (1), oracle function with nhibernate (1), running function through nhibernate (1), nhibernate call oracle package (1), calling nhibernate procedures oracle asp net mvc (1), calling oracçe function nhibernate net (1), calling oracle function from nhibernate (1), calling package Nhibernate (1), executing oracle function with nhibernate (1), function with nhibernate (1), functions in nhibernate in oracle (1), functions nhibernate (1), how to exec function in oracle (1), in function in nhibernate net (1), net execute oracle function return (1), nhibernate (1), nhibernate call or execute oracle (1), vb net oracle function (1)

Advertise Here

1 comment so far

Add Your Comment
  1. Hello, I apologize for contacting you in this fashion, but I think you might be interested in submitting your site to my new tech directory…The Tech Directory at thetazzone.net

    I’m assuming comments are moderated so when I click submit this post won’t automatically appear on site, if it does, I again apologize.

* Copy this password:

* Type or paste password here: