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.

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.
About Hardono
Howdy! I'm Hardono. I am working as a
Software
Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.
I think String-truncating algorithm is quite important. Because some words will have a totally different meaning when you accidentally precise in removing the trailing letters.
I think this could be the best example of when things go wrong. I saw it on my LinkedIn page:

Names are hidden to protect the innocent(s) 😀
A simple check to the truncated string, whether it ends with a face-blushing word or not, should be sufficient.
About Hardono
Howdy! I'm Hardono. I am working as a
Software
Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.
Oh no…. the vowels are missing from Gmail’s login page!!!!

Another cool April Fool’s treat from Google 🙂
About Hardono
Howdy! I'm Hardono. I am working as a
Software
Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.