AndroMDA/JIRA Created: (HIB-215) bidirectional relations using List

View: New views
2 Messages — Rating Filter:   Alert me  

AndroMDA/JIRA Created: (HIB-215) bidirectional relations using List

by JIRA jira@andromda.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

bidirectional relations using List
----------------------------------

         Key: HIB-215
         URL: http://jira.andromda.org/browse/HIB-215
     Project: Hibernate Cartridge
        Type: Bug

    Versions: 3.2-RC1    
 Environment: Andromda 3.2
    Reporter: Jorge Rodríguez Pedrianes
 Assigned to: Carlos Cuenca


Hello, I'm trying to use biridectional relations whithin two entities but hbm files are wrong. For example

          E1 (1)  ---------- E2(0..*)

   The hbm file generated for E1 is not ok:
         .......
      <list name="e2" lazy="true" fetch="select" inverse="false" cascade="all,delete-orphan">
            <key foreign-key="E1_LIC" not-null="false">                      <!-- This is bad, the correct is not-null="true" if i use list and E1 its required-->
                <column name="E1_FK" sql-type="BIGINT"/>
            </key>
            <list-index column="indice"/>
            <one-to-many class="E2"/>
        </list>
       ....

   I see the hibernate template (hibernate.hbm.xml.vm) and i see the problem:

     in one2Many section code you put:
          ${indent}    <key foreign-key="$sourceEnd.foreignKeyConstraintName"#if ($otherEnd.list) not-null="$otherEnd.required"#end>

   but i think that is better:
          ${indent}    <key foreign-key="$sourceEnd.foreignKeyConstraintName"#if ($otherEnd.list) not-null="$sourceEnd.required"#end> <!-- if source end its  
                                                                                                                                                                                                                                                         required -->

   I read the hibernate reference and say:
                 "It is important that you define not-null="true" on the <key> element of the collection mapping if the underlying
                  foreign key column is NOT NULL. Don't only declare not-null="true" on a possible nested <column> element,
                  but on the <key> element."

   Thanks


--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

AndroMDA/JIRA Updated: (HIB-215) bidirectional relations using List

by JIRA jira@andromda.org :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

     [ http://jira.andromda.org/browse/HIB-215?page=all ]

Plushnikov Michail updated HIB-215:
-----------------------------------

    Attachment: hibernate.hbm.xml.vm.patch

> bidirectional relations using List
> ----------------------------------
>
>          Key: HIB-215
>          URL: http://jira.andromda.org/browse/HIB-215
>      Project: Hibernate Cartridge
>         Type: Bug

>     Versions: 3.2-RC1
>  Environment: Andromda 3.2
>     Reporter: Jorge Rodríguez Pedrianes
>     Assignee: Carlos Cuenca
>  Attachments: hibernate.hbm.xml.vm.patch
>
> Hello, I'm trying to use biridectional relations whithin two entities but hbm files are wrong. For example
>           E1 (1)  ---------- E2(0..*)
>    The hbm file generated for E1 is not ok:
>          .......
>       <list name="e2" lazy="true" fetch="select" inverse="false" cascade="all,delete-orphan">
>             <key foreign-key="E1_LIC" not-null="false">                      <!-- This is bad, the correct is not-null="true" if i use list and E1 its required-->
>                 <column name="E1_FK" sql-type="BIGINT"/>
>             </key>
>             <list-index column="indice"/>
>             <one-to-many class="E2"/>
>         </list>
>        ....
>    I see the hibernate template (hibernate.hbm.xml.vm) and i see the problem:
>      in one2Many section code you put:
>           ${indent}    <key foreign-key="$sourceEnd.foreignKeyConstraintName"#if ($otherEnd.list) not-null="$otherEnd.required"#end>
>    but i think that is better:
>           ${indent}    <key foreign-key="$sourceEnd.foreignKeyConstraintName"#if ($otherEnd.list) not-null="$sourceEnd.required"#end> <!-- if source end its  
>                                                                                                                                                                                                                                                          required -->
>    I read the hibernate reference and say:
>                  "It is important that you define not-null="true" on the <key> element of the collection mapping if the underlying
>                   foreign key column is NOT NULL. Don't only declare not-null="true" on a possible nested <column> element,
>                   but on the <key> element."
>    Thanks

--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.andromda.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
LightInTheBox - Buy quality products at wholesale price!