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

Christian Jaeger (JIRA) noreply at atlassian.com
Fri Apr 17 11:19:18 EDT 2009


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-2782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=32912#action_32912 ] 

Christian Jaeger commented on HHH-2782:
---------------------------------------

This bug is still present in the current version (Branch 3.2 and Trunk).
Branch 3.1 does not show it.

It is a major issue because this bug makes the dynamic components nearly unusable.

In addition to having the rebuildType() method added, I'd suggest the following solution:

When the component is declare as "dynamic", buildType() should be called automatically every time getType() is accessed.


This way, this bug should be quite easy to fix.

> Component getType caches the type value
> ---------------------------------------
>
>                 Key: HHH-2782
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2782
>             Project: Hibernate Core
>          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