I have a class which has both an "implements" meta tag and a composite-id tag. When I use the hbm2java tool to generate java code, the generated composite-id class ends up implementing the interface, as well as the class. Unfortunately, the composite-id class will not compile unless I add the properties defined in the interface, which I can't do.
Mapping file:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping default-cascade="save-update">
<class name="com.foo.bar.data.base.DataObject" table="data_objects">
<meta attribute="implements">com.foo.bar.data.util.Auditable</meta>
<composite-id name="id" class="com.foo.bar.data.CompositeID" unsaved-value="any">
<key-property name="foo" type="long" column="foo"/>
<key-property name="bar" type="long" column="bar"/>
</composite-id>
<property name="created" type="timestamp" not-null="true" unique="false"/>
<property name="modified" type="timestamp" not-null="true" unique="false"/>
</class>
</hibernate-mapping>
Generates a CompositeID class like this:
Code:
package com.foo.bar.data;
import java.io.Serializable;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
/** @author Hibernate CodeGenerator */
public class CompositeID implements com.foo.bar.data.util.Auditable,Serializable {
/** identifier field */
private long foo;
/** identifier field */
private long bar;
....
}
Is this intended behavior or a bug?