Hello everyone,
I'm trying to map a class and it's subclasses. above is my hbm file. The superclass(Contrato) has in it's key a key to another object (Seguradora). When I add the hbm with the super/sub classes (Contrato), hibernator says that there are no persistance for the object Seguradora.
Can anyone help me?
here is the error msg:
Code:
net.sf.hibernate.MappingException: No persister for: fenaseg.rns.bo.Seguradora
   at net.sf.hibernate.impl.SessionFactoryImpl.getPersister(SessionFactoryImpl.java:420)
   at net.sf.hibernate.impl.SessionFactoryImpl.getIdentifierType(SessionFactoryImpl.java:586)
   at net.sf.hibernate.type.ManyToOneType.getColumnSpan(ManyToOneType.java:21)
   at net.sf.hibernate.type.ComponentType.getColumnSpan(ComponentType.java:58)
   at net.sf.hibernate.persister.NormalizedEntityPersister.<init>(NormalizedEntityPersister.java:732)
   at net.sf.hibernate.persister.PersisterFactory.create(PersisterFactory.java:32)
   at net.sf.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:207)
   at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:627)
   at net.sf.hibernator.HibernateConnection.query(HibernateConnection.java:185)
   at net.sf.hibernator.views.QueryView$QueryTask.run(QueryView.java:255)
   at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:101)
here is the hbm with the super/sub classes:
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
    "-//Hibernate/Hibernate Mapping DTD 2.0//EN"
    "http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
    
<hibernate-mapping>
<!-- 
    Created by the Middlegen Hibernate plugin
    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->
<class 
    name="fenaseg.rns.bo.ContratoSeguroVeiculo" 
    table="CONTRATO_SEGURO_VEICULO"
    mutable="false"
>
    <meta attribute="class-description" inherit="false">
       @hibernate.class
        table="CONTRATO_SEGURO_VEICULO"
        mutable="false"
    </meta>
    <composite-id>
        <meta attribute="class-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
        <key-property 
            name="idContratoSeguroVeiculo" 
            column="ID_CONTRATO_SEGURO_VEICULO" 
            type="java.lang.Integer"
            length="9"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="ID_CONTRATO_SEGURO_VEICULO"
                length="9"
            </meta> 
        </key-property>
        <key-property 
            name="idTipoContrato" 
            column="ID_TIPO_CONTRATO" 
            type="java.lang.Integer"
            length="1"
        >
            <meta attribute="field-description">
               @hibernate.property
                column="ID_TIPO_CONTRATO"
                length="1"
            </meta> 
        </key-property>
        <!-- bi-directional many-to-one association to Seguradora -->
        <key-many-to-one
           name="seguradora"
           class="fenaseg.rns.bo.Seguradora"
       >
            <meta attribute="field-description">
               @hibernate.many-to-one
                column="FK_ID_SEGURADORA_CONTRATO""
            </meta>
           <column name="FK_ID_SEGURADORA_CONTRATO" />
       </key-many-to-one>
    </composite-id>    
    <property
        name="dtCadastro"
        type="java.sql.Timestamp"
        column="DT_CADASTRO"
        length="7"
    >
        <meta attribute="field-description">
           @hibernate.property
            column="DT_CADASTRO"
            length="7"
        </meta>    
    </property>
    <!-- associations -->
    <!-- bi-directional many-to-one association to Estipulante -->
    <many-to-one
        name="estipulante"
        class="fenaseg.rns.bo.Estipulante"
        not-null="true"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="FK_ID_ESTIPULANTE"         
        </meta>
        <column name="FK_ID_ESTIPULANTE" />
    </many-to-one>
    <!-- bi-directional many-to-one association to VeiculoBin -->
    <many-to-one
        name="veiculoBin"
        class="fenaseg.rns.bo.VeiculoBin"
        not-null="true"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="FK_ID_VEICULO_SEGURADO"         
        </meta>
        <column name="FK_ID_VEICULO_SEGURADO" />
    </many-to-one>
    <!-- bi-directional many-to-one association to Corretor -->
    <many-to-one
        name="corretor"
        class="fenaseg.rns.bo.Corretor"
        not-null="true"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="FK_ID_CORRETOR"         
        </meta>
        <column name="FK_ID_CORRETOR" />
    </many-to-one>
    <!-- bi-directional many-to-one association to Operador -->
    <many-to-one
        name="operador"
        class="fenaseg.rns.bo.Operador"
        not-null="true"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="FK_ID_SEGURADORA_OPERADOR"         
           @hibernate.column name="FK_ID_OPERADOR"         
        </meta>
        <column name="FK_ID_SEGURADORA_OPERADOR" />
        <column name="FK_ID_OPERADOR" />
    </many-to-one>
    <!-- bi-directional many-to-one association to SeguradoVeiculo -->
    <many-to-one
        name="seguradoVeiculo"
        class="fenaseg.rns.bo.SeguradoVeiculo"
        not-null="true"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
            not-null="true"
           @hibernate.column name="FK_ID_SEGURADO"         
        </meta>
        <column name="FK_ID_SEGURADO" />
    </many-to-one>
    <!-- uni-directional many-to-one association to RamoSeguro -->
    <many-to-one
        name="ramoSeguro"
        class="fenaseg.rns.bo.RamoSeguro"
    >
        <meta attribute="field-description">
           @hibernate.many-to-one
           @hibernate.column name="FK_ID_RAMO_SEGURO"         
           @hibernate.column name="FK_ID_GRUPO_RAMO"         
        </meta>
        <column name="FK_ID_RAMO_SEGURO" />
        <column name="FK_ID_GRUPO_RAMO" />
    </many-to-one>
    <!-- bi-directional one-to-many association to ItemContratoFrota -->
    <set
        name="itemContratoFrotas"
        lazy="true"
        inverse="true"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            inverse="true"
          @hibernate.collection-key
           column="FK_ID_CONTRATO_SEGURO"
          @hibernate.collection-key
           column="FK_ID_TIPO_CONTRATO"
          @hibernate.collection-key
           column="FK_ID_SEGURADORA_CONTRATO"
           @hibernate.collection-one-to-many
            class="fenaseg.rns.bo.ItemContratoFrota"
        </meta>
        <key>
            <column name="FK_ID_CONTRATO_SEGURO" />
            <column name="FK_ID_TIPO_CONTRATO" />
            <column name="FK_ID_SEGURADORA_CONTRATO" />
        </key>
        <one-to-many 
            class="fenaseg.rns.bo.ItemContratoFrota"
        />
    </set>
    <!-- bi-directional one-to-many association to CondutorContrato -->
    <set
        name="condutorContratos"
        lazy="true"
        inverse="true"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            inverse="true"
          @hibernate.collection-key
           column="FK_ID_CONTRATO_SEGURO_VEICULO"
          @hibernate.collection-key
           column="FK_ID_TIPO_CONTRATO"
          @hibernate.collection-key
           column="FK_ID_SEGURADORA_CONTRATO"
           @hibernate.collection-one-to-many
            class="fenaseg.rns.bo.CondutorContrato"
        </meta>
        <key>
            <column name="FK_ID_CONTRATO_SEGURO_VEICULO" />
            <column name="FK_ID_TIPO_CONTRATO" />
            <column name="FK_ID_SEGURADORA_CONTRATO" />
        </key>
        <one-to-many 
            class="fenaseg.rns.bo.CondutorContrato"
        />
    </set>
    <!-- bi-directional one-to-many association to CertifApoliceGrupoVeiculo -->
    <set
        name="certifApoliceGrupoVeiculos"
        lazy="true"
        inverse="true"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            inverse="true"
          @hibernate.collection-key
           column="FK_CONTRATO_SEGURO"
          @hibernate.collection-key
           column="FK_ID_TP_CONTRATO_SEGURO"
          @hibernate.collection-key
           column="FK_ID_SEGURADORA_CONTRATO"
           @hibernate.collection-one-to-many
            class="fenaseg.rns.bo.CertifApoliceGrupoVeiculo"
        </meta>
        <key>
            <column name="FK_CONTRATO_SEGURO" />
            <column name="FK_ID_TP_CONTRATO_SEGURO" />
            <column name="FK_ID_SEGURADORA_CONTRATO" />
        </key>
        <one-to-many 
            class="fenaseg.rns.bo.CertifApoliceGrupoVeiculo"
        />
    </set>
    <!-- bi-directional one-to-many association to EventoSinistroApolice -->
    <set
        name="eventoSinistroApolices"
        lazy="true"
        inverse="true"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            inverse="true"
          @hibernate.collection-key
           column="FK_ID_CONTRATO_VEICULO_EVENTO"
          @hibernate.collection-key
           column="FK_ID_TIPO_CONTRATO_EVENTO"
          @hibernate.collection-key
           column="FK_ID_SEGURADORA_CONTRATO"
           @hibernate.collection-one-to-many
            class="fenaseg.rns.bo.EventoSinistroApolice"
        </meta>
        <key>
            <column name="FK_ID_CONTRATO_VEICULO_EVENTO" />
            <column name="FK_ID_TIPO_CONTRATO_EVENTO" />
            <column name="FK_ID_SEGURADORA_CONTRATO" />
        </key>
        <one-to-many 
            class="fenaseg.rns.bo.EventoSinistroApolice"
        />
    </set>
    <!-- bi-directional one-to-many association to EndossoContratoVeiculo -->
    <set
        name="endossoContratoVeiculos"
        lazy="true"
        inverse="true"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            inverse="true"
          @hibernate.collection-key
           column="FK_ID_CONTRATO_SEGURO"
          @hibernate.collection-key
           column="FK_TIPO_CONTRATO"
          @hibernate.collection-key
           column="FK_ID_SEGURADORA_CONTRATO"
           @hibernate.collection-one-to-many
            class="fenaseg.rns.bo.EndossoContratoVeiculo"
        </meta>
        <key>
            <column name="FK_ID_CONTRATO_SEGURO" />
            <column name="FK_TIPO_CONTRATO" />
            <column name="FK_ID_SEGURADORA_CONTRATO" />
        </key>
        <one-to-many 
            class="fenaseg.rns.bo.EndossoContratoVeiculo"
        />
    </set>
    <!-- bi-directional many-to-many association to TipoCobertura -->
    <set
        name="tipoCoberturas"
        lazy="true"
        table="TIPO_COBERTURA_CONTRATO_VEIC"
    >
        <meta attribute="field-description">
           @hibernate.set
            lazy="true"
            table="TIPO_COBERTURA_CONTRATO_VEIC"
          @hibernate.collection-key
           column="FK_ID_CONTRATO_SEGURO_VEICULO"
          @hibernate.collection-key
           column="FK_ID_TIPO_CONTRATO"
          @hibernate.collection-key
           column="FK_ID_SEGURADORA_CONRTATO"
           @hibernate.collection-many-to-many
            class="fenaseg.rns.bo.TipoCobertura"
            column="FK_ID_TP_COBERTURA"
           @hibernate.collection-many-to-many
            class="fenaseg.rns.bo.TipoCobertura"
            column="FK_ID_GRUPO_RAMO"
        </meta>
        <key>
            <column name="FK_ID_CONTRATO_SEGURO_VEICULO" />
            <column name="FK_ID_TIPO_CONTRATO" />
            <column name="FK_ID_SEGURADORA_CONRTATO" />
        </key>
        <many-to-many
            class="fenaseg.rns.bo.TipoCobertura"
        >
            <column name="FK_ID_TP_COBERTURA" />
            <column name="FK_ID_GRUPO_RAMO" />
        </many-to-many>
    </set>
   <joined-subclass  name="fenaseg.rns.bo.ApoliceVeiculo" 
      table="APOLICE_VEICULO" lazy="true">
       
        <meta attribute="class-description" inherit="false">
           @hibernate.id
            generator-class="assigned"
        </meta>
        
        <key>
           <column name="FK_ID_CONTRATO_SEGURO_VEICULO" />
            <column name="FK_ID_TIPO_CONTRATO" />
            <column name="FK_ID_SEGURADORA_CONTRATO" />
        </key>
        
        <property
           name="cdApoliceSeguradora"
           type="java.lang.String"
           column="CD_APOLICE_SEGURADORA"
           length="20"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="CD_APOLICE_SEGURADORA"
               length="20"
           </meta>    
       </property>
       <property
           name="dtInicioVigencia"
           type="java.sql.Timestamp"
           column="DT_INICIO_VIGENCIA"
           length="7"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="DT_INICIO_VIGENCIA"
               length="7"
           </meta>    
       </property>
       <property
           name="dtFimVigencia"
           type="java.sql.Timestamp"
           column="DT_FIM_VIGENCIA"
           length="7"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="DT_FIM_VIGENCIA"
               length="7"
           </meta>    
       </property>
       <property
           name="dsApolice"
           type="java.lang.String"
           column="DS_APOLICE"
           length="3500"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="DS_APOLICE"
               length="3500"
           </meta>    
       </property>
    </joined-subclass>
    <joined-subclass  name="fenaseg.rns.bo.PropostaVeiculo" 
    table="PROPOSTA_VEICULO" lazy="true" >
       <key>       
           <column name="FK_ID_CONTRATO_SEGURO_VEICULO" />
           <column name="FK_ID_TP_CONTRATO" />
            <column name="FK_ID_SEGURADORA_CONTRATO"  />
            
       </key>
      <property
           name="cdPropostaSeguradora"
           type="java.lang.String"
           column="CD_PROPOSTA_SEGURADORA"
           length="25"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="CD_PROPOSTA_SEGURADORA"
               length="25"
           </meta>    
       </property>
       <property
           name="dsProposta"
           type="java.lang.String"
             column="DS_PROPOSTA"
           length="40"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="DS_PROPOSTA"
               length="40"
           </meta>    
       </property>
       <property
           name="dtEmissaoProposta"
           type="java.sql.Timestamp"
           column="DT_EMISSAO_PROPOSTA"
           length="7"
       >
           <meta attribute="field-description">
              @hibernate.property
               column="DT_EMISSAO_PROPOSTA"
               length="7"
           </meta>    
       </property>
    </joined-subclass>
</class>
</hibernate-mapping>
Code: