[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2782) Component getType caches the type value

Kiss Zoltán (JIRA) noreply at atlassian.com
Tue Aug 14 09:19:13 EDT 2007


Component getType caches the type value
---------------------------------------

                 Key: HHH-2782
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2782
             Project: Hibernate3
          Issue Type: Bug
    Affects Versions: 3.2.5
         Environment: all
            Reporter: Kiss Zoltán


Component class caches the value of the type attribute:

    public Type getType() throws MappingException {
        // added this caching as I noticed that getType() is being called multiple times...
        if ( type == null ) {
            type = buildType();
        }
        return type;
    }

This forbids the use of 'dynamic attributes'.
For eg. if you try to add new properties to an existing dynamic-component with the addProperty method, then the rebuild of the session factory will failed, because the Component property will be invalid during the validation (in the Component there will be a different column span value, then in the cached ComponentType).
There should be a method like this in the Component class:

    public void rebuildType() {
        type = buildType();
    }

With the help of this the type could be rebuild if it is necessary.

-- 
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