[hibernate-issues] [Hibernate-JIRA] Commented: (HBX-752) Add meta attribute property-code, pre/post conditions code

Max Rydahl Andersen (JIRA) noreply at atlassian.com
Sun Sep 10 09:37:24 EDT 2006


    [ http://opensource.atlassian.com/projects/hibernate/browse/HBX-752?page=comments#action_24396 ] 

Max Rydahl Andersen commented on HBX-752:
-----------------------------------------

i'm not super keen on having this since it encourages to put code in the templates...especially code that also require some context (e.g. what is the generated field name and the name or the setter argument).

I know we have extra-class code attribute but it does not rely on any context, so is more harmless.

...i don't call the current solution "brute-force" since it feels like the just correct level of customization is there for you to do these things without any problems.

in other words, unless someone submits a patch or i bump into an extremely good and widely used usecase for this i'm not going to work on it in the the near future.

> 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

>
>
> 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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list