]
Steve Ebersole updated HHH-2907:
--------------------------------
Fix Version/s: (was: 3.5.0.Beta-1)
3.5-tmp
ability to apply 'generation strategy' to generated
properties
--------------------------------------------------------------
Key: HHH-2907
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2907
Project: Hibernate Core
Issue Type: New Feature
Components: core
Reporter: Steve Ebersole
Assignee: Steve Ebersole
Priority: Minor
Fix For: 3.5
Currently, the support for generated properties allows only for db-generated values (ala
triggers etc). Would be great to allow the user to provide a seperate (optional) strategy
for generating the generated values.
It would be nice to have a generic solution, which we can build on top of for the more
common use cases. Also, we may need to use a name other than 'generated' in the
annotations to avoid conflicts with the current @Generated annotation; for now lets use
the term @Dynamic.
Consider mapping a 'created timestamp' column. Currently, provided we are using
a trigger, that would look like:
@Generated(INSERT) Date created;
The strategy here (^^) is implicitly 'db', as the db is taking care of the
generation. In the most generic form, that could be written as:
@Dynamic(time=INSERT,strategy=DB) Date created;
Additionally, since this is such a common case, also allow this:
@CreationTimestamp Date created;
The final form would also allow the definition of strategies. As an example, consider:
@CreationTimestamp(strategy=NOW) Date created;
Here we are not relying on the db to generate the value, but are explicitly telling
Hibernate to do it (basically 'use the current timestamp to generate a value here
whenever we do an insert').
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: