How can I override the automatic constructor generation in a hbm.xml file?
Using the following code results in an error that the construcotrs are already defined.
Code:
<meta attribute="class-code">
public static final Integer MY_STATIC_ATTRIB_ID_1 = new Integer(1);
public static final Integer MY_STATIC_ATTRIB_ID_2 = new Integer(2);
public MyClass()
{
this.myAttribId = MyClass.MY_STATIC_ATTRIB_1;
this.myAttribStr = MyClass.MY_STATIC_ATTRIB_1.toString();
}//end default constructor
public MyClass(Integer myClassAttribId)
{
this.myAttribId = ;
switch ( myClassAttribId )
{
case 1: this.myAttribId = MyClass.MY_STATIC_ATTRIB_ID_1;
this.myAttribStr = MyClass.MY_STATIC_ATTRIB_1.toString;
break;
case 2: this.myAttribId = MyClass.MY_STATIC_ATTRIB_ID_2;
this.myAttribStr = MyClass.MY_STATIC_ATTRIB_2.toString;
default: break;
}
}//end default constructor
</meta>