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

David Leal (JIRA) noreply at atlassian.com
Sun Sep 10 09:27:24 EDT 2006


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