facebook

Hibernate mapping – One table per class hierarchy

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #224818 Reply

    carlosmoraes
    Member

    Hi there.

    Is it posible to map a “One table per class hierarchy” approach using the MyEclipse hibernate tool?
    In case I’m not clear (my english maybe bad), here is how the mapping file looks (but I shouldn’t do this manually, right?):

    <hibernate-mapping package="com.carlosmoraes.hibernate">
    
        <class name="Pessoa" table="PESSOA">
            <id name="nupessoa" column="NUPESSOA" type="integer">
                <generator class="identity"/>
            </id>
     
            <discriminator name="className" column="CLASS_NAME" type="string" />
            <property name="nomepessoa" column="NOMEPESSOA" type="string"  not-null="true" />
            <property name="email" column="EMAIL" type="string" />
            <property name="obs" column="OBS" type="serializable" />
            <subclass name="PessoaFisica" discriminator-value="PF">
                <property name="cpf" column="CPF" type="string" />
                <property name="rg" column="RG" type="string" />
                <property name="orgexp" column="ORGEXP" type="string" />
                <property name="dtnasc" column="DTNASC" type="date" />
                <property name="sexo" column="SEXO" type="string" />
            </subclass>
            <subclass name="PessoaJuridica" discriminator-value="PJ">
                <property name="nomeempresa" column="NOMEEMPRESA" type="string" />
                <property name="razaosocial" column="RAZAOSOCIAL" type="string" />
                <property name="cnpj" column="CNPJ" type="string" />
                <property name="inscestadual" column="INSCESTADUAL" type="string" />
                <property name="nomecontato" column="NOMECONTATO" type="integer" />
            </subclass>
            <property name="dtcadastro" column="DTCADASTRO" type="date" />
            <property name="dtultmod" column="DTULTMOD" type="date" />
     
            <many-to-one name="conhecimento" column="CONHECIMENTO_FKNUCONHECIMENTO" class="Conhecimento"  not-null="true" />
     
            <many-to-one name="fone" column="FONE_FKNUFONE" class="Fone"  not-null="true" />
     
            <many-to-one name="estcivil" column="ESTCIVIL_FKNUESTCIVIL" class="Estcivil"  not-null="true" />
     
            <many-to-one name="endereco" column="ENDERECO_FKNUENDERECO" class="Endereco"  not-null="true" />
        </class>
        
    </hibernate-mapping>

    Any ideas?

    Thanks in advance,

    Carlos

    #224833 Reply

    Riyad Kalla
    Member

    Carlos,
    We don’t currently support class hierarchies like this, it would just map to one giant class… but I am double checking with the developer on this just incase I am wrong.

    #224834 Reply

    carlosmoraes
    Member

    All right.
    I’m trying to manage thing manually by now.

    Thanks for the reply.

    #224935 Reply

    support-jeff
    Member

    My master plan includes support for this kind of mapping (in fact, all three ways to map inheritance hierarchies), but it will probably not make the next major release (3.9?).

    #224942 Reply

    carlosmoraes
    Member

    I hope you achieve this soon.
    It would be great!

    Keep up the good work.

    Best regards,

    Carlos

    #225114 Reply

    Robert Varga
    Participant

    My master plan includes support for this kind of mapping (in fact, all three ways to map inheritance hierarchies), but it will probably not make the next major release (3.9?).

    This is not a trivial request, since it needs info which can only be set manually. It might be worth looking at the Hibernate capabilities, if there are some other manually settable info already present? 🙂

    Is there a doc on what it is currently capable of?

    Regards,

    Robert

    #225150 Reply

    support-jeff
    Member

    robert –

    I am not following you on the first part of your message. Is there a question here?

    As for documentation, the only docs available at this time are here:
    http://www.myeclipseide.com/ContentExpress-display-ceid-61.html
    These are very out of data. I did an update of them last year, but I do not know why the update has not been uploaded yet. I will have to check on that.

    #225175 Reply

    Robert Varga
    Participant

    @support-jeff wrote:

    robert –

    I am not following you on the first part of your message. Is there a question here?

    Not really… it was just a remark, that probably it is worth looking at it… 🙂

    I thought it is just capable of generating some mapping from the database but no manual influence or intervention on it… But it might be otherwise… 🙂 Anyway an up-to-date documentation would be more than welcome…

    Regards,

    Robert Varga

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Hibernate mapping – One table per class hierarchy

You must be logged in to post in the forum log in