[ 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=/

Reply via email to