-->
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.  [ 5 posts ] 
Author Message
 Post subject: encryption : formula and read-write property
PostPosted: Fri Sep 03, 2004 12:32 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
Hibernate version: 2.1.2

Is there a way to specify a formula for writing data? I realize the formula attribute of a property can be used for "computed" properties, but what about computing the value that will be inserted?

A specific (and I think common) use case would be encrypting/decrypting functions.

On read, I would like to use the db function decrypt(dbvalue).

On write, I would like to use the db function encrypt(javavalue).

So that ultimately: the java object only ever contains unencrypted values, and the db only ever contains encrypted values.

I think I can get around this using 2 properties (1 mapped as formula, and 1 mapped as a "normal" property; the written unencrypted value will updated using a separate db call during flush via interceptor), but it is far from elegant.

A user type could also work, but similarly there would need to be a extra db call for each read, and for each write.

Thanks for any advice!
Tyson


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 03, 2004 2:48 pm 
Regular
Regular

Joined: Wed May 05, 2004 3:41 pm
Posts: 118
Location: New Jersey,USA
if you use the "property" based persistence scheme Hibernate, Hibernate core is going to call your getXXXX and setXXX() while retrieving or saving your data. Can't you put the logic for encryption or decryption there?

-Anand


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 03, 2004 2:51 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 6:24 pm
Posts: 45
Storing the encryption logic in the java code would be my preference, but circumstances govern that the encryption logic be stored within the database. (i.e. other applications access the same data, using only stored procedures and other db-centric code...)


Top
 Profile  
 
 Post subject: 1.5 years later - is there a solution to this?
PostPosted: Thu Mar 16, 2006 3:28 pm 
Newbie

Joined: Wed Apr 27, 2005 10:22 pm
Posts: 8
I need to do the exact same thing as this user. Does v3 provide a way to do it?

Thanks,
Max


Top
 Profile  
 
 Post subject: Was this question ever answered?
PostPosted: Mon Dec 03, 2007 5:30 pm 
Newbie

Joined: Mon Dec 03, 2007 5:23 pm
Posts: 1
I need to be able to use Hibernate with SQLServer2005 encryption, as opposed to something like Jasypt which does the encryption within the java web server.

It looks like you could load data from the database using the formula property but there is no obvious way to do the inserts and updates.

I see from this post I am not alone. Is there a decent solution for this?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.