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

Hernán Chanfreau (JIRA) noreply at atlassian.com
Wed Jul 29 10:50:12 EDT 2009


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