Jump to content
Sign in to follow this  
socopo

mapeamento suclasses hibernate

Recommended Posts

socopo

Boas, tenho este ficheiro para mapear umas classes com o Hibernate 3.2 e dá-me um erro relativamente aos <joined-subclass>

Se alguem souber o que está a falhar aqui agradecia imenso.

O erro ou aviso é o seguinte

org.xml.sax.SAXParseException: The content of element type "joined-subclass" must match "(meta*,subselect?,synchronize*,comment?,tuplizer*,key,(property|many-to-one|one-to-one|component|dynamic-component|properties|any|map|set|list|bag|idbag|array|primitive-array)*,joined-subclass*,loader?,sql-insert?,sql-update?,sql-delete?,resultset*,(query|sql-query)*)".

<!-- Identity -->
    <class name="bean.Identity" table="identity" abstract="true">
        <id name="id" type="int">
            <column name="identity_ID" />
            <generator class="increment" />
        </id>
        <!-- propriedades... -->

        <!-- Candidate -->
        <joined-subclass name="bean.Candidate" table="candidate" abstract="true">
            <key column="identity_ID"/>
            <id name="candidate_ID" type="int">
                <column name="candidate_ID" />
                <generator class="increment" />
            </id>
            <!-- propriedades... -->

            <!-- CandidateNotReimbursed -->
            <joined-subclass name="bean.CandidateNotReimbursed" table="candidateNotReimbursed">
                <key column="candidate_ID" />
                <id name="id_nr" type="int">
                    <column name="id" />
                    <generator class="increment" />
                </id>
                <!-- propriedades... -->

            </joined-subclass>
            <!-- END CandidateNotReimbursed -->

            <!-- CandidateReimbursed -->
            <joined-subclass name="bean.CandidateReimbursed" table="candidateReimbursed">
                <key column="candidate_ID" />
                <id name="id_r" type="int">
                    <column name="id_r" />
                    <generator class="increment" />
                </id>
                <!-- propriedades... -->
                
            </joined-subclass>
            <!-- END CandidateReimbursed -->
        </joined-subclass>
        <!-- END Candidate -->
        
        <!-- Client -->
        <joined-subclass name="bean.Client" table="client" abstract="true">
            <key column="identity_ID" />
            <id name="client_ID">
                <column name="client_ID" />
                <generator class="increment" />
            </id>
            <!-- propriedades... -->

            <!-- ClientNotReimbursed -->
            <joined-subclass name="bean.ClientNotReimbursed" table="clientNotReimbursed">
                <key column="client_ID" />
                <id name="id_nr">
                    <column name="id_nr"/>
                    <generator class="increment" />
                </id>
			<!-- propriedades... -->
            </joined-subclass>
            <!-- END ClientNotReimbursed -->

            <!-- ClientReimbursed -->
            <joined-subclass name="bean.ClientReimbursed" table="clientReimbursed">
                <key column="client_ID" />
                <id name="id_r">
                    <column name="id_r" />
                    <generator class="increment" />
                </id>
                <!-- propriedades... -->
            </joined-subclass>
            <!-- END ClientReimbursed -->

        </joined-subclass>
        <!-- END Client -->

    </class>
    <!-- END Identity -->

Share this post


Link to post
Share on other sites
socopo

Já descobri o problema. Aparentemente não pode haver <id> na subclass, agora o problema é que eu preciso do id nas subclasses por causa das subclasses dessas  :wallbash:

Alguém pode ajudar?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.