-->
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: running sql before a load
PostPosted: Wed Feb 14, 2007 11:32 pm 
Newbie

Joined: Tue Feb 06, 2007 4:51 pm
Posts: 3
Hi,

I have an encrypted column in a table mapped as follows:
Code:
<property name="GivenNames" column="GivenNames"
              access="field.camelcase-underscore"
              formula="DecryptByKey(GivenNames)"/>


DecryptByKey is an SQL Server 2005 function, but the key that it uses for decryption must be opened first as follows:

Code:
open symmetric key ssn_key_01 decryption by certificate test;


How do I run this statement prior to a session.load?

I tried the following without any luck
Code:
                TestIdentity id1 = new TestIdentity();
           
                ISession sess1 = NHibernateSessionManager.Instance.GetSession();

                sess1.BeginTransaction();
               
                IDbCommand cmd = sess1.Connection.CreateCommand();

                sess1.Transaction.Enlist(cmd);

                cmd.CommandText = "open symmetric key ssn_key_01 decryption by certificate ecstest;";
                               
                cmd.ExecuteNonQuery();

                sess1.Load(id1, 7);

                sess1.Transaction.Commit();


Hibernate version: 1.0.4.0


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