[hibernate-dev] Patch for HHH-272: Custom SQL for column gets and sets

Max Rydahl Andersen max.andersen at redhat.com
Thu Sep 10 10:39:40 EDT 2009


thanks - I forgot the "insert sql literals into the insert/update/query 
sql"  requirement :)

/max

Rob Hasselbaum wrote:
> On 09/07/2009 06:37 PM, Max Rydahl Andersen wrote:
>> What is this doing that a parameterized custom type can't do ? Is 
>> this "just" to get a cleaner hbm.xml syntax or ?
>>
>> /max
>
> Hi Max,
>
> It addresses two issues that a custom type cannot address. First, it 
> enables calling database functions that don't have an equivalent (or 
> efficient) Java implementation. And second, since the conversion logic 
> happens inside the database, relational operations can be applied to 
> the decoded value such as sorting and non-equality searching.
>
> For example, my primary use case is encryption. We have implemented an 
> encryption package inside Oracle and we don't wish to replicate that 
> logic in Java. But more importantly, there are certain fields that the 
> business has told us we must encrypt (for example, the user's last 
> name), but we still need to be able to sort on the plain text values 
> and do partial-match searches using the LIKE operator. This can't be 
> achieved with a custom type; the conversion must happen inside the 
> database.
>
> Regards,
> -Rob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/hibernate-dev/attachments/20090910/e0228160/attachment.html 


More information about the hibernate-dev mailing list