[
http://opensource.atlassian.com/projects/hibernate/browse/HBX-752?page=co...
]
Max Rydahl Andersen commented on HBX-752:
-----------------------------------------
i'm sorry but i don't see what is different in your suggestion than what you can
do today ?!
why don't you just had pre-condition etc. into your hbm.xml files ?
Your example in the forum is currently hard coded - why don't you just put the code
into the hbm.xml and inserted in the templates just as with extra-code ?
And again, extra-code is only there for users to configure the construction of objects
...and because it can be be done without any context.
Add meta attribute property-code, pre/post conditions code
----------------------------------------------------------
Key: HBX-752
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HBX-752
Project: Hibernate Tools
Type: Improvement
Components: hbm2java
Versions: 3.2beta7
Reporter: David Leal
Priority: Minor
Just to suggest to add a new meta attribute like class-code, but for properties. Some
times you need to add some pre-condition or post-condition for a set/get method. For
example a particular property has to be possitive, not all databases could control this
condition, so you have to control it via source code, for example to add a pre-condition
on a set operation.
The hbm2java allow to add additional methods/imports, for example via class-code meta
attribute, but for the generation properties the user doesn't have any control about
the generated code.
My suggestion is to add three possible meta-attributes:
property-get/set-code: For setting the hole generated code for a particular property,
with a non-default set/get code generation.
pre-get/set-code: Just add a precondition code to the generated source code.
post-get/set-code: Just add a postcondition code, at the end of the code generation, for
a particular property.
All three properties can be specified for get/set operation.
About this topic I have asked to the forum,
http://forum.hibernate.org/viewtopic.php?t=964523#2321689
but the solution was to modify the template, wich in my humble opinion is a kind of brute
force for this simple modification.
Thanks in advance,
David Leal
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira