Title: [Hibernate] Subclassing super() error

I think I've discovered a fairly serious bug with the joined-subclass class
generation.

As an example, here is the following schema:

<class name="com.some.path.DatabaseObject" table="objects">
<id name="id" type="string" length="32">
  <column name="object_id" sql-type="char(32)"/>
  <generator class="uuid.hex"/>
</id>

<property name="dbCreationTs"
          column="db_creation_ts"
          type="calendar"
          not-null="true">
  <meta attribute="field-description">
    The timestamp the record was inserted into the database.
  </meta>
</property>

<joined-subclass name="com.some.path.Party" table="parties">
   <meta attribute="class-description">
     A party is any "contactable" entity.  That is, a party can be a   
person, a group of people (such as a business/company), or any other
interactable entity.
   </meta>
   <key>
     <column name="party_id" sql-type="char(32)"/>
   </key>

   <set name="emailAddresses" table="party_email_address_maps"
        inverse="true" lazy="true">
     <key>
       <column name="party_id" sql-type="char(32)"/>
     </key>
     <one-to-many class="com.some.path.EmailAddress"/>
   </set>
   <set name="phoneNumbers" table="party_phone_number_maps"
        inverse="true" lazy="true">
     <key>
       <column name="party_id" sql-type="char(32)"/>
     </key>
     <many-to-many class="com.come.path.PhoneNumber">
       <column name="phone_number_id" sql-type="char(32)"/>
     </many-to-many>
   </set>
   <set name="postalAddresses" table="party_postal_address_maps"
        inverse="true" lazy="true">
     <key>
       <column name="party_id" sql-type="char(32)"/>
     </key>
     <many-to-many class="com.some.path.PostalAddress">
       <column name="postal_address_id" sql-type="char(32)"/>
     </many-to-many>
   </set>

   <joined-subclass name="com.some.path.Person" table="people">
     <key>
       <column name="person_id" sql-type="char(32)"/>
     </key>
     <component name="Name" class="com.some.path.PersonName">
       <property name="salutation" type="string">
         <column name="salutation" sql-type="char(5)"/>
       </property>
       <property name="givenName" type="string" length="100"
                 column="given_name" not-null="true"/>
       <property name="middleNames" type="string" column="middle_names"/>
       <property name="surname" type="string" length="100"
                 not-null="true"/>
       <property name="suffix" type="string" length="100"/>
     </component>
     <property name="gender" type="string">
       <column name="gender" sql-type="char(6)"/>
     </property>

     <joined-subclass name="com.some.path.User" table="users">
       <key>
         <column name="user_id" sql-type="char(32)"/>
       </key>
       <property name="username" type="string" length="100"
                 not-null="true" unique="true"/>
       <property name="encryptedPassword" type="string" length="100"
                 column="encrypted_password"/>
       <property name="passwordLastChangedTs" type="calendar"
                 column="password_last_changed_ts" not-null="true"/>
       <property name="passwordExpirationTs" type="calendar"
                 column="password_expiration_ts">
         <meta attribute="field-description">
           null value means it never expires.
         </meta>
       </property>
       <property name="timeZone" type="float" column="time_zone"/>
       <property name="locked" type="boolean" not-null="true"
                 column="is_locked"/>
     </joined-subclass> <!-- end User class definition -->

   </joined-subclass> <!-- end Person class definition -->

 </joined-subclass> <!-- end Party class definition -->

</class> <!-- end DatabaseObject class definition -->


So, given the above schema,

a User ISA Person ISA Party ISA DatabaseObject.

However, the generated code for the User class calls (in its "minimal"
constructor):

super(dbCreationTs, emailAddresses, phoneNumbers, postalAddresses, name);

There is no constructor in the Person class with that signature (the super
call should pass in "gender" as well).  The Person class has only one
constructor (no minimal constructor), and its signature is:

Person (Calendar dbCreationTs, Set emailAddresses, Set phoneNumbers, Set
postalAddresses, String gender, PersonName name);

Therefore, the User class is trying to, it its minimal constructor, call a
super constructor that doesn't exist.

I'm not sure if this is an error with generation of the Person class or the
User class...(perhaps the Person class?  Maybe it should include a minimal
Constructor that doesn't have gender, since it is nullable, i.e. not
required?  Not sure...).

Can someone enlighten me why this occurs if it is _not_ a bug?  If it is a
bug, can someone fix it soon, as I can't continue my project without this OO
hierarchy in place :)  If it is a bug, can someone definitively let me know
so I can add it to JIRA?

I'd be willing to help in any way I can (coding too), so please let me know
if you need it.

Thanks!

Les Hazlewood

Reply via email to