Hibernate version: 3.1
Mapping documents:
Code:
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping package="nl.acc.model">
<class name="SuperClazz" table="superclazz">
<meta attribute="scope-class">public abstract</meta>
<meta attribute="generated-class" inherit="false">nl.acc.model.hibernate.BaseSuperClazz</meta>
<meta attribute="implement-equals">true</meta>
<id name="id" type="java.lang.Long">
<meta attribute="use-in-equals">true</meta>
<generator class="native" />
</id>
<property name="p1" type="string" not-null="true" />
<property name="p2" type="character" not-null="false" />
<property name="p3" type="string" not-null="false" />
<joined-subclass name="SubClazz"
table="subclazz">
<meta attribute="generated-class" inherit="false">nl.acc.model.hibernate.BaseSubClazz</meta>
<key column="id" />
</joined-subclass>
</class>
</hibernate-mapping>
hbm2java generates the following constructors from this mapping:
Code:
public abstract class BaseSubClazz extends nl.acc.model.SuperClazz implements java.io.Serializable {
/** default constructor */
public BaseSubClazz() {
}
/** minimal constructor */
public BaseSubClazz(String p1) {
super(p1);
}
/** full constructor */
public BaseSubClazz(String p1, Character p2, String p3) {
super(p1, p2, p3);
}
...
}
This code implies that I have to implement constructors which accept arguments (p1, p2, p3) and (p1) in my concrete SubClazz, which is not very elegant. Why does beta2 generate a "minimal" and "full" constructor anyway? The approach of beta1 (a default and id constructor) worked for me.
Kind regards,
Bas