[hibernate-dev] Patch for HHH-272: Custom SQL for column gets and sets
rob at hasselbaum.net
Wed Sep 2 17:17:51 EDT 2009
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:
<column name="credit_card_num" sql-set="encrypt(?)"
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,
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the hibernate-dev