[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3794?page=c...
]
Adam Warski resolved HHH-3794.
------------------------------
Assignee: Adam Warski
Resolution: Fixed
Fix Version/s: 3.5
Done
Issue when method return type is Interface
------------------------------------------
Key: HHH-3794
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3794
Project: Hibernate Core
Issue Type: Bug
Components: envers
Reporter: Amar Singh
Assignee: Adam Warski
Fix For: 3.5
I came across this problem while using Hibernate-envers-3.4-SNAPSHOT with
Hibernate-3.3.GA or Hibernate-3.4-SNAPSHOT. Below is my hbm.xml file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping default-lazy="false"
package="com.xyz.fwk.persistence.hibernate.impl.bug.demo.test">
<class name="Trade" table="trade" batch-size="64"
lazy="false">
<id name="id" type="int" access="field">
<generator class="native"></generator>
</id>
<component name="tradeId" class="TypeIdentifier">
<property name="id" column="TRADE_ID"/>
<property name="type" column="TRADE_ID_TYPE"/>
</component>
</class>
</hibernate-mapping>
My class definition for Trade is:
Code:
@Audited (this doesn't matter)
public class Trade implements Serializable {
protected int id;
protected ITypeIdentifier tradeId ;
public Trade() { }
public ITypeIdentifier getTradeId() { return tradeId; }
public void setTradeId(ITypeIdentifier i) { tradeId =i ; }
}
Since the getTradeId returns and ITypeIdentifier which is an interface, (hence has no
super class) the method addPropertiesFromClass(XClass clazz) in
org.hibernate.envers.configuration.metadata.reader.AuditedPropertiesReader
when trying to analyze ITypeIdentifier fails because the interface has no super class !
Code:
private void addPropertiesFromClass(XClass clazz) {
XClass superclazz = clazz.getSuperclass();
(super class will be null for an interface return type )
if (!"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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira