-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Possible bug in Middlegen!
PostPosted: Mon Feb 09, 2004 1:33 pm 
Pro
Pro

Joined: Wed Oct 08, 2003 10:31 am
Posts: 247
I'm generating my mapping files with Middlegen R3.
I got serious problems when I first tried to use "composite-id's". Now, the problem was found. Middlegen is not generating the composite-id components in the right order. In the example below, ManPrev should come first and then ManPrevOper. This gave me "referential integraty violation" each time I tried an insert.

MpMpo
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 Middlegen Hibernate plugin

    http://boss.bekk.no/boss/middlegen/
    http://hibernate.sourceforge.net/
-->

<class
    name="vo.MpMpo"
    table="mp_mpo"
>

    <composite-id name="comp_id" class="vo.MpMpoPK">
        <!-- bi-directional many-to-one association to ManPrevOper -->
        <key-many-to-one
           name="manPrevOper"
           class="vo.ManPrevOper"
       >
           <column name="man_prev_oper_fk" />
       </key-many-to-one>
        <!-- bi-directional many-to-one association to ManPrev -->
        <key-many-to-one
           name="manPrev"
           class="vo.ManPrev"
       >
           <column name="man_prev_fk" />
       </key-many-to-one>
    </composite-id>   

    <property
        name="estado"
        type="java.lang.String"
        column="estado"
        length="1"
    />

    <!-- associations -->
    <!-- bi-directional one-to-many association to HistoricoManPrev -->
    <set
        name="historicoManPrevs"
        lazy="true"
        inverse="true"
    >
        <key>
            <column name="man_prev_fk" />
            <column name="man_prev_oper_fk" />
        </key>
        <one-to-many
            class="vo.HistoricoManPrev"
        />
    </set>

</class>
</hibernate-mapping>


Switched the two and know it works.
Should this be posted on JIRA David?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 09, 2004 7:36 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
This is a know problem. No need to post it I am looking into it. Thanks for the report.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.