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

Steve Ebersole steve at hibernate.org
Wed Sep 2 18:02:56 EDT 2009


Awesome!  This is one of those things I always wanted to get implemented
but it was always getting pushed down my priority list.  Thanks for
taking on that work.

I'll definitely take a look this week.  If you could work it up for
trunk that would be better.  New features should really not get added to
maintenance releases.

On Wed, 2009-09-02 at 17:17 -0400, Rob Hasselbaum wrote:
> Hi,
> 
> I've submitted a patch with unit tests for HHH-272 and I'm interested
> in feedback. The patch allows users to specify custom SQL get and set
> expressions for property columns. This can be used to call SQL
> functions or perform some other kind of database-side conversion
> without giving up automatic statement generation. You use it like
> this:
> 
> <property name="creditCardNumber">
>   <column name="credit_card_num" sql-set="encrypt(?)"
> sql-get="decrypt(credit_card_num)"/>
> </property>
> 
> This is similar to a formula property with two differences. First, the
> data is backed by a real column, which gets exported with the schema.
> And second. the data is read-write, not read-only. The sql-get
> expression gets applied in predicates, order clauses, projections,
> etc.
> 
> The patch should work for all property columns including those in
> components and composite-elements. I didn't try to get id, key, index,
> or other kinds of non-property columns to work. It is built on top of
> the 3.3.2.GA tag, but I can port it to trunk if necessary. I also have
> a patch nearly ready to expose this functionality in Hibernate
> Annotations in case the Core patch is accepted. If any commiters could
> have a look, I'd appreciate it.
> 
> Thanks for your time,
> -Rob Hasselbaum
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev
-- 
Steve Ebersole <steve at hibernate.org>
Hibernate.org




More information about the hibernate-dev mailing list