[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4063) NPE reading metadata from an mapped interface

Hernán Chanfreau (JIRA) noreply at atlassian.com
Thu Jul 30 11:21:12 EDT 2009


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

Hernán Chanfreau commented on HHH-4063:
---------------------------------------

We realized that our solution only solves the NullPointerException, but still do not care about interfaces.

For example, if B is "subinterface" of A,  during the process of extracting the audited metadata,  AuditedPropertiesReader  do not extract the metadata from interface A as a superinterface of B. So you can loose audited properties...



> NPE reading metadata from an mapped interface
> ---------------------------------------------
>
>                 Key: HHH-4063
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4063
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>    Affects Versions: 3.3.2
>         Environment: Hibernate-core 3.3.2GA, Envers 1.2.1GA
>            Reporter: Hernán Chanfreau
>         Attachments: interface.mapping.test.zip
>
>
> The problem arises when there is a mapped interface to load as a persistent class. 
> The metadata reader from envers do not care about interfaces.
> See the discussion about it here:
> http://www.jboss.org/index.html?module=bb&op=viewtopic&t=156233
> We've patch envers doing this:
> In AuditedPropertiesReader.addPropertiesFromClass(XClass clazz) we add the condition superclazz != null.
> 	private void addPropertiesFromClass(XClass clazz)  {
> 		XClass superclazz = clazz.getSuperclass();
>                // superclazz != null applies when superclazz is an interface
> 		if ((superclazz != null) && (!"java.lang.Object".equals(superclazz.getName()))) {
> 			addPropertiesFromClass(superclazz);
> 		}
> 		addFromProperties(clazz.getDeclaredProperties("field"), "field", fieldAccessedPersistentProperties);
> 		addFromProperties(clazz.getDeclaredProperties("property"), "property", propertyAccessedPersistentProperties);
> 	}

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